FG
💻 Software

Unix: Files starting with a dash, -

Fresh7 days ago
Mar 15, 202613284 views
Confidence Score0%
0%

Problem

Ok, I have a bunch of files starting with a dash, -. Which is not so good... and I want to rename them. In my particular case I would just like to put a character in front of them. I found the following line that should work, but because of it dash it doesn't: If I put an in front of the I get a bu…

Error Output

for file in -N*.ext; do mv $file x$file; done

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Unix: Files starting with a dash, -

Low Risk

You need to use the keyword to tell the mv command that the arguments are not to be interpreted as options. Watch: Use after all the options on the commandline. Eg, if you're trying to use the option to mv, it would go before :

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment