|
Files that begin with a dash can be removed by typing
rm ./-filenameA couple other ways that may work are
rm -- -filenameand
rm - -filenameNow let's suppose that we an even nastier filename. One that I ran across this summer was a file with no filename. The solution I used to remove it was to type
rm -i *This executes the rm command in interactive mode. I then answered "yes" to the query to remove the nameless file and "no" to all the other queries about the rest of the files. Another method I could have used would be to obtain the inode number of the nameless file with
ls -iand then type
find . -inum number -ok rm '{}' \;where number is the inode number. The -ok flag causes a confirmation prompt to be displayed. If you would rather live on the edge and not be bothered with the prompting, you can use -exec in place of -ok. Suppose you didn't want to remove the file with the funny name, but wanted to rename it so that you could access it more readily. This can be accomplished by following the previous procedure with the following modification to the find command:
find . -inum number -ok mv '{}' new_filename \;
© 1993-2000 Christopher C. Taylor |
|||||||