5

How can I move multiple folders into another directory ? For example, I would like to move the folder 000/ 001/ 002/ to train/000/ train/002 train/003. Is there a simple command that I can use like

mv --from 000/ 001/ 002/ --to train/000/ train/002 train/003
muru
  • 193,181
  • 53
  • 473
  • 722
Kong
  • 1,151
  • 7
  • 32
  • 60

2 Answers2

9

I could type whatever was typed in this article again, but here: https://discuss.devopscube.com/t/how-to-move-mv-multiple-directories-or-files-to-a-folder-at-a-time/100

The basic command is:

You can do this using -t flag with the mv command.

The syntax would look like the following.

  mv -t <destination> <src1> <src2> .... <srnN>
terdon
  • 98,183
  • 15
  • 197
  • 293
NemuruYama
  • 176
  • 1
  • 6
  • Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Thomas Ward Dec 03 '18 at 00:22
  • 1
    `mv -t 10 11 12 HW` `mv: illegal option -- t` is `zsh` – CodeFinity Jul 29 '21 at 13:02
2

I would suspect:

mv {001..100}/ train/

Just replace 100 with your folder range.

jackw11111
  • 794
  • 8
  • 21