Hello, today I’ll tell you how to remove (or rename) a file that begins with a dash… That’s a kind of files who can be really boring when you’re about to manage space, backups, or whatever you have to do with files.
So, I won’t be long, the main problem here is to deal with file like « -myDoc.txt ». If you’re trying to rename it, the only response is:
# mv -myDoc.txt myDoc.txt
mv: invalid option -- m
Try `mv --help' for more information.
In fact, the system just interprets file name as part of command line options. In our example « -m » isn’t a known « mv » switch, so there’s an error.
To pass over that problem, simply use this syntax:
# mv ./-myDoc.txt myDoc.txt
Here the interpreter will take care of the current directory (the « ./ ») and will do the job correctly and easily