Skip to main content
clarify we're talking of GNU coreutils here.
Source Link
Stéphane Chazelas
  • 586.4k
  • 96
  • 1.1k
  • 1.7k

The GNU coreutils mv already has an option specifying that you want to move to a directory: -t / --target-directory. If the argument to that option doesn't exists, mv will complain instead of moving all of your files to the same filename.

I would have written your mover as follows:

find . -name '* 9?.mp3' -exec mv -t 90 {} + 

Note the use of + instead of \;, globbing as many filenames together as possible, resulting in faster execution.

The coreutils mv already has an option specifying that you want to move to a directory: -t / --target-directory. If the argument to that option doesn't exists, mv will complain instead of moving all of your files to the same filename.

I would have written your mover as follows:

find . -name '* 9?.mp3' -exec mv -t 90 {} + 

Note the use of + instead of \;, globbing as many filenames together as possible, resulting in faster execution.

The GNU coreutils mv already has an option specifying that you want to move to a directory: -t / --target-directory. If the argument to that option doesn't exists, mv will complain instead of moving all of your files to the same filename.

I would have written your mover as follows:

find . -name '* 9?.mp3' -exec mv -t 90 {} + 

Note the use of + instead of \;, globbing as many filenames together as possible, resulting in faster execution.

Source Link
Anthon
  • 81.4k
  • 42
  • 174
  • 228

The coreutils mv already has an option specifying that you want to move to a directory: -t / --target-directory. If the argument to that option doesn't exists, mv will complain instead of moving all of your files to the same filename.

I would have written your mover as follows:

find . -name '* 9?.mp3' -exec mv -t 90 {} + 

Note the use of + instead of \;, globbing as many filenames together as possible, resulting in faster execution.