LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Removing odd file name (https://www.linuxquestions.org/questions/linux-general-1/removing-odd-file-name-4175478410/)

Corrado 09-24-2013 06:42 PM

Removing odd file name
 
I have a problem and haven't been too successful in resolving.

There is a file with the name '--remove-files' that I am trying to remove from a directory.

Any suggestions on how to do this? I am using the bash shell.

Code:

-rw-r--r--  1 root    root  3464407040 Jan 22  2011 --remove-files

suicidaleggroll 09-24-2013 06:53 PM

Stick a ./ in front of it, or give the full path to the file
Code:

rm ./--remove-files

unSpawn 09-24-2013 07:01 PM

Quote it, escape it (backslashes) or end rm options with "--"?

suicidaleggroll 09-24-2013 07:13 PM

Quoting and escaping don't work, FYI

Found that out when I was trying to just create the file to test removing it.

unSpawn 09-24-2013 07:46 PM

Well OK then, quoting and end options with "--":
Code:

]$ touch -- "--remove-files"
]$ file -- "--remove-files"
--remove-files: empty
]$ rm -f -- "--remove-files"

;-p

suicidaleggroll 09-24-2013 10:09 PM

lol

"--" to end options is a good one


All times are GMT -5. The time now is 06:24 PM.