LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Can't delete a file that starts with - (https://www.linuxquestions.org/questions/linux-software-2/cant-delete-a-file-that-starts-with-435906/)

vtrac 04-17-2006 04:19 AM

Can't delete a file that starts with -
 
I've somehow created a file that starts with a '-' and I can't seem to do anything to it. The file is "-backup_log.log", and everytime I try to delete it, move it, vi it, the command thinks it's a unrecognized flag:

Quote:

# mv "-hm_backup_log.log" asdf.log
mv: invalid option -- h
Try `mv --help' for more information.
I've tried quotes, escaping the -, etc. Any ideas? :)

bathory 04-17-2006 04:25 AM

Iyou have mc installed use it to delete the file.

vivek reddy 04-17-2006 04:39 AM

in case you do not have mc installed.

you can copy the file to a temp directory and delete the whole directory. use the absolute path. i just tried, it worked. if anyone has a easier method, please help..

guedellas 04-17-2006 05:21 AM

I guess that rm ./-hm_backup_log.log should solve your problem

vtrac 04-17-2006 05:25 AM

Quote:

Originally Posted by guedellas
I guess that rm ./-hm_backup_log.log should solve your problem

Brilliant. I don't know why I didn't think of that. Thanks.


All times are GMT -5. The time now is 01:43 PM.