LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-19-2009, 01:39 PM   #1
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
ANDs and APOSTROPHIES won't let me delete files!!!! :(


In cleaning up some files, I found a few that have &'s and apostrophies in the filename. These characters are not allowing me to delete or move, nor can I rename these files.

How do I get rid of these files?
 
Old 05-19-2009, 02:00 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Did you escape the filenames, or use quotes as appropriate? I can delete, move, copy, and perform other operations on such files just fine. Which shell are you using?
 
Old 05-19-2009, 03:47 PM   #3
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
Here's an example with both &'s and apostrophies:
Code:
$ ls -lah
drwxr-xr-x 2 myuser myuser 4.0K 2009-05-19 14:21 Daniel & Wm's Favorites
$ rmdir 'Daniel & Wm'\''s Favorites'/
rmdir: Daniel & Wm's Favorites/: Permission denied
Can you help me with the escape sequences?
 
Old 05-19-2009, 04:03 PM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,502

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
I created a file named: Daniel & Wm's Favorites
and deleted it with command: rm "Daniel & Wm's Favorites"

Did the same with a directory which also worked, double quotes. Don't think that is the problem. Your error is "permission denied", I'd check for write permissions on the parent folder or do it as root.
 
Old 05-19-2009, 06:48 PM   #5
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by yancek View Post
I created a file named: Daniel & Wm's Favorites
and deleted it with command: rm "Daniel & Wm's Favorites"

Did the same with a directory which also worked, double quotes. Don't think that is the problem. Your error is "permission denied", I'd check for write permissions on the parent folder or do it as root.
Geez. I was reading "permission denied" as it was having trouble rendering the filenames, and throwing a generic error. Not that there were actual permissions errors. I had checked permissions a couple of directories back and they were correct. But these files were nested about 6 directories in. I did find one that, for some reason, was marked read-only. I reset it, and was able to delete the tree.

Hence, you were correct, and I have thanked you.
 
Old 05-19-2009, 07:14 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
I guess I should've asked about "not allowing". Glad to see yancek picking that one up.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script help - delete files older than 45 days but exclude the system files jojothedogboy Linux - Software 3 06-13-2008 03:43 PM
Playing Mp3 ands VCDs on SUSE? vharishankar SUSE / openSUSE 7 01-11-2006 08:49 AM
How to delete files that won't delete? di11rod Linux - Security 7 10-19-2005 09:14 PM
Linux Ands Ati Dont Go Go Tgether Help genixpro Linux - Hardware 1 09-12-2004 11:29 PM
How to delete the destination files while the source files deleted in cp -u ? myunicom Linux - General 4 09-26-2003 01:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration