Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can't delete files that begin with a tilde (~)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
rev138
l33t
l33t


Joined: 19 Jun 2003
Posts: 848
Location: Vermont, USA

PostPosted: Wed Dec 28, 2005 7:57 pm    Post subject: Can't delete files that begin with a tilde (~) Reply with quote

I opened an MS Word doc in windows from a SAMBA share, and Word left one of those ~dsfdf.tmp files behind.

Try as I might have, I couldn't delete it in linux. If I typed
Code:
# rm ~dsfdf.tmp
the system thought I was referrencing something in my home directory. I had to go back into windows to get rid of the file.

Does anyone know of a less aggravating way to fix this? :)

Thanks.
Back to top
View user's profile Send private message
codergeek42
Bodhisattva
Bodhisattva


Joined: 05 Apr 2004
Posts: 5142
Location: Anaheim, CA (USA)

PostPosted: Wed Dec 28, 2005 8:00 pm    Post subject: Reply with quote

You can enclose the file name in single quotes to have the shell pass it through to rm as-is:
Code:
$ rm '~file.tmp'
Hope that helps!
_________________
~~ Peter: Programmer, Mathematician, STEM & Free Software Advocate, Enlightened Agent, Transhumanist, Fedora contributor
Who am I? :: EFF & FSF
Back to top
View user's profile Send private message
Maedhros
Bodhisattva
Bodhisattva


Joined: 14 Apr 2004
Posts: 5511
Location: Durham, UK

PostPosted: Wed Dec 28, 2005 8:01 pm    Post subject: Reply with quote

Alternatively, you can just escape the tilde. :wink:
Code:
rm \~dsfdf.tmp

_________________
No-one's more important than the earthworm.
Back to top
View user's profile Send private message
rev138
l33t
l33t


Joined: 19 Jun 2003
Posts: 848
Location: Vermont, USA

PostPosted: Wed Dec 28, 2005 8:03 pm    Post subject: Reply with quote

Thanks guys. Hopefully it won't happen again, but it's nice to have the right trick up my sleve if it does.
Back to top
View user's profile Send private message
linuxtuxhellsinki
l33t
l33t


Joined: 15 Nov 2004
Posts: 700
Location: Hellsinki

PostPosted: Thu Dec 29, 2005 3:58 am    Post subject: Reply with quote

& also with
Code:
# rm ./~dsfdf.tmp

_________________
1st use 'Search' & lastly add [Solved] to
the subject of your first post in the thread.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum