May 20
Copy files in Linux with hyphen as the first char in file name
If you directory have files like
-somefile_with_hyphen_as_first_char.txt
and you try to copy it and get an error like
cp -somefile_with_hyphen_as_first_char.txt something_else.txt
cp: invalid option — o
Because of the filename with hyphen act as a parameter, so you can’t just do regular cp. Try this instead
cp — -somefile_with_hypgen_as_first_char.txt something_else.txt
Hope this will someone,l later
admin on May 20th, 2008 | File Under Linux/Unix | No Comments -