Comment on mv *.jpg is complete bullshit.

<- View Parent
GenderNeutralBro@lemmy.sdf.org ⁨9⁩ ⁨months⁩ ago

Ahhh. That’s a confusing thread, with a couple confounding factors.

The OP in that thread is attempting to a batch rename, which is out of scope of the mv command.

If you are NOT trying to change the name of the file, I recommend always making the last argument of mv your destination directory, rather than the destination file. This is strictly mandatory if you are moving multiple files.

OP in that SO thread used the filename as the destination path — a filename which did not exist, and therefore could not be resolved by the wildcard. And if it had existed, the move would have failed. Because of that, mv /data/*/Sample_*/logs/*_Data_time.err /data/*/Sample_*/logs/*_Data_time_orig.err is not a valid command.

OP cannot accomplish what they want with a single mv command. They would need to use a loop or something like find.

I agree that the lack of universal consistency in how commands handle arguments is unfortunate. There’s no way around that without reinventing the entire OS. Many commands let you pass ‘–’ as an argument to signify that any subsequent arguments should not be interpreted as options even if they begin with ‘-’. But that’s entirely up to the implementation of each program; it’s not a shell feature.

Future OS designers: consider typed arguments. Abandon all legacy cruft.

source
Sort:hotnewtop