The scenario is I have a bunch of files:

peter1.json peter2.json peter3.json peter4.json tom1.json tom2.json tom3.json tom4.json jane1.json jane2.json jane3.json jane4.json plus various other files I don't want to move.

And I want to move those files into a folder called data. I tried variations on mv peter* tom* jane* /data and it doesn't work.

Am I using the wrong tool for the job? Should this be possible with mv?

At present I get a message:

usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory
  • Updated with output from Terminal
    – Ben Frain
    Sep 14 '21 at 13:57
  • 2
    That's actually an interesting error to get, it's totally uninformative...
    – ilkkachu
    Sep 14 '21 at 14:01

From the error message, it looks like that's from the mv on Mac.

I'm guessing what you did was

mv peter* tom* jane* /data

while you meant ./data or just data, i.e. to point at a directory in the current working directory, and not to one at the filesystem root.

If I try to move some files to a non-existing directory on a GNU system, I get the far more useful message:

$ mv foo bar /data
mv: target '/data' is not a directory

but indeed the mv on Mac just gives that useless usage guide, without bothering to tell what's actually wrong.

  • Yes, that was it!
    – Ben Frain
    Sep 14 '21 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.