[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?

Looks like due to some kind of encoding mixup, the file name that is
eventually passed to unlink does not match the name in the 'Archive'
directory.

I'd be tempted to create an ../Archive.bak directory, move everything
apart from the file you can't delete to .bak directory, and do an 'rm
-rf ../Archive' .. and if that works an 'mv ../Archive.bak ../Archive'.

Another option that comes to mind is to use emacs' directory editing
capabilities.

On the other hand I'm not too sure about the file's inode changing from
one stat command to the next. Maybe talk to the vendor's tech support?

CJ





Reply to: