Results 1 to 7 of 7
Someone crated a file with starting "--" as starting file_name.
I have "--file-name", with no GUI; all commands I tried to operate this file return with error since they interpret ...
- 07-28-2011 #1
How to deal with file starting with"--"
Someone crated a file with starting "--" as starting file_name.
I have "--file-name", with no GUI; all commands I tried to operate this file return with error since they interpret this "--" as argument tag.
Tried to use quote, doesn't help.
For curiosity, how to deal with it?
Thanks,
- 07-28-2011 #2
- escape the - with \
- the -print0 of the find command also helps
- ls -i shows the inode, which then could be used to do operations on the fileYou must always face the curtain with a bow.
- 07-28-2011 #3
# mv \--index.html index.html
mv: unrecognized option `--index.html'
could not get "\" to work, but I found a walk around by just using absolute path.
Thanks,
- 07-28-2011 #4
Ah sorry. There is a much easier way.
You can tell the commands (probably not all, so be carefull), that there wont be any more options by giving a --
Code:touch -- --index.html ls -la -- --index.html mv -- --index.html index.html ls -la -- index.html
You must always face the curtain with a bow.
- 07-28-2011 #5Linux Guru
- Join Date
- May 2011
- Posts
- 1,838
and if you're lazy and don't want to read man pages - open up nautilus, browse to the file and do whatever with it...
- 08-07-2011 #6Just Joined!
- Join Date
- Aug 2011
- Posts
- 35
you could also use quotes for example cp "--myfile" "destination"
- 08-09-2011 #7Just Joined!
- Join Date
- Aug 2011
- Posts
- 7
I don't think this works. Putting an option in quotes still leaves it the same option. It will complain that --myfile is not a valid option. Whereas
will work, because it tells cp that everything after the -- is not an option.Code:cp -- --myfile destination


Reply With Quote