How to Remove Files ?
You may have files created with non-printable characters in the file name and have hard time removing them. Although
ls
has the flag -q
to help you to display non-graphic characters as ?, the question mark is not the actual character. It is only a representation of the non-printable character. In order to find out the character, you can use od
(octal dump) to dump them out in ASCII characters or backslash escapes format. Simply run ls -1
(minus one) and pipe the output to od -c
To remove these type of files, you can get ls -li
to list out all the inode number and use the inode number (inum) in find
to locate the file for removal.
#ls -li 123848 -rw-r--r-- 1 user staff 0 Feb 11 21:13 some funny file #find . -inum 123848 -exec rm -i {} \; rm: remove regular file `./some funny file'?y
Alternatively, you can do a rm -i ./*
and say no to all except the file you want to remove. That may sound a bit dangerous.
Labels: unix
0 Comments:
Post a Comment
<< Home