MYSYSAD.COM

Delete a Filename with an Invalid Character

· Shell & text · Files & disks

Once in awhile, you will have to delete a file name that was created with an invalid character. Frankly speaking, this can be a little tricky to deal with.

Here is an example. This is a filename with an invalid character, "-", in front of it.

# cd /tmp
# ls
-esofthub
# rm /-esofthub
or
# rm -- -esofthub

or by inode
# ls -i
# find . -inum 968746 -exec rm -i {} \;