How can I handle (e.g. apply mv command) in a command shell the files with leading dash (-) in names? The command
mv -weirdfilename.zip normalfilename.zip
naturally accepts - at the beginning of a filename as an argument.
Two ways:
-- indicates end of command options, so everything follows that are treated as arguments:
mv -- -weirdfilename.zip normalfilename.zip
Use ./ to indicate a file name explicitly:
mv ./-weirdfilename.zip normalfilename.zip
-- might not always work for just - as a file name since it might have special meaning (e.g. stdin/stdout) in some programs.