1

I have a bunch of MP4 videos in a directory tree (by category), and I want to recursively copy them all to a single directory on another drive. I tried:

cp -R -p -f /hdd1mnt/Videos/*.mp4 /hdd2mnt/

But it just copies the few files in the /hddname/Videos/ directory and doesn't copy any of them from sub-directories under that. I've tried a few variations, but they all give the same result- no recursion. Please steer me right!

Thanks, Bill

lunix
  • 65

1 Answers1

0

Using The find Command

find: Search for files in a directory hierarchy

Generic:

find [sourcePath] -name ‘[filename]’ -exec cp {} [targetPath] \;

Your Example:

find /hdd1mnt/Videos/ -name '*.mp4' -exec cp {} /hdd2mnt/ \;

Replace -name with -iname to ignore case.

Broadsworde
  • 4,532