Search code examples
linuxbashcopyrenamearchive

Copy all photos on an entire drive in bash?


I have a drive that mounts at /run/media/jeremy/MONSTER that has a ton of old backups of aperture libraries, iPhoto libraries, and general backups of home directories from the years.

I'd like to track down every gif, jpg, jpeg, and cannon raw file and copy them to /run/media/jeremy/1.4t_Video/photos and optimally have them given a unique name based on the file creation date. I assume bash is up to the task, but not sure how to go about it.


Solution

  • find /run/media/jeremy/MONSTER \( -iname \*.gif -o -iname \*.jpg -o -iname \*.jpeg \) -exec cp {} /run/media/jeremy/1.4t_Video/photos/ \;
    

    this should find all files ending in those extensions and copies them over to /run/media/jeremy/1.4t_Video/photos/

    if you want to add more extensions just use -o -iname *.