2

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
2
  • Updated with output from Terminal
    – Ben Frain
    Commented Sep 14, 2021 at 13:57
  • 2
    That's actually an interesting error to get, it's totally uninformative...
    – ilkkachu
    Commented Sep 14, 2021 at 14:01

1 Answer 1

2

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.

1
  • Yes, that was it!
    – Ben Frain
    Commented Sep 14, 2021 at 15:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .