1

I have a file called -my-file-name.txt. I'm trying to move it using the mv command, however it fails because the hyphen in the name is acting like an option.

mv -my-file-name.txt /some/new/folder

mv: invalid option -- 'm'

try 'mv --help' for more information.

How can I work around this?

I've tried the obvious, wrapping in single quotes (''), double quotes ("") and square brackets ([]), but none of these work.

devklick
  • 111
  • 1
    The duplicate question concerns rm, but the solution is the same for mv, use mv -- -my-file-name.txt /some/new/folder or mv ./-my-file-name.txt /some/new/folder. – Kusalananda May 23 '19 at 22:02
  • Thank you! This wasnt obvious from the --help options – devklick May 23 '19 at 22:08

0 Answers0