[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Can't Delete File with Bad Chars



On Thu, Dec 10, 2009 at 06:04:03PM EST, Kent West wrote:
I've got a TeraStation Pro Network Attached Storage device connected to
a stable Debian box. I'm trying to free up some space by deleting old
backups, but have come across a file with a bad name. I'm smbmounting
the NAS to get to the file structure; I'm not real sure how the NAS
drives are formatted.

When I run "stat [tab key to autocomplete the name]" I get a different
node number often.

westk[@]goshen.acu.edu]:/TERASTATIONBACKUP/RSYNC-BACKUP/home/web/html/mriggs/Archive/Spring
2008/445:> stat Tentative\ Schedule\ \?��\ Math\ 445.pdf
  File: `Tentative Schedule ?\307\364 Math 445.pdf'
  Size: 49699         Blocks: 104        IO Block: 16384  regular file
Device: 11h/17d    Inode: 59670244    Links: 1
Access: (0766/-rwxrw-rw-)  Uid: (  101/    sshd)   Gid: (  100/   users)
Access: 2009-02-20 13:57:10.000000000 -0600
Modify: 2008-01-23 09:29:06.000000000 -0600
Change: 2009-02-20 13:57:08.000000000 -0600

westk[@]goshen.acu.edu]:/TERASTATIONBACKUP/RSYNC-BACKUP/home/web/html/mriggs/Archive/Spring
2008/445:> stat Tentative\ Schedule\ \?��\ Math\ 445.pdf
stat: cannot stat `Tentative Schedule ?\307\364 Math 445.pdf': No such
file or directory

(The second attempt was just to recall my history with the up arrow; I
have to fill in the stat command with the TAB key to get any data.)

Then I tried to delete the file with some magic I found via Google:


westk[@]goshen.acu.edu]:/TERASTATIONBACKUP/RSYNC-BACKUP/home/web/html/mriggs/Archive/Spring
2008/445:> find . -inum 59670414 -exec rm -i {} \;
rm: remove regular file `./Tentative Schedule ?\307\364 Math 445.pdf'? y
rm: cannot remove `./Tentative Schedule ?\307\364 Math 445.pdf': No such
file or directory

Then I try the stat command again, and find the inode number has changed:

westk[@]goshen.acu.edu]:/TERASTATIONBACKUP/RSYNC-BACKUP/home/web/html/mriggs/Archive/Spring
2008/445:> stat Tentative\ Schedule\ \?��\ Math\ 445.pdf
  File: `Tentative Schedule ?\307\364 Math 445.pdf'
  Size: 49699         Blocks: 104        IO Block: 16384  regular file
Device: 11h/17d    Inode: 59670677    Links: 1
Access: (0766/-rwxrw-rw-)  Uid: (  101/    sshd)   Gid: (  100/   users)
Access: 2009-02-20 13:57:10.000000000 -0600
Modify: 2008-01-23 09:29:06.000000000 -0600
Change: 2009-02-20 13:57:08.000000000 -0600


Any suggestions as to how I can delete this file?

The best way that I have found in these situations is to use a file manager like mc, or pcmanfm. That way you select the file and delete it. Since the file is selected by the file manager it already knows which file to delete.

--
Marc Shapiro
mshapiro_42@yahoo.com



Reply to: