Skip navigation

Automated Locate and Move .JPG Files HELP!

534 Views 5 Replies Latest reply: Oct 23, 2012 3:29 PM by Neville Hillyer RSS
CEStryker Calculating status...
Currently Being Moderated
Oct 23, 2012 11:00 AM

I am trying to locate and move all .JPG files on my MacBook running OS X 10.6. I need a Script that will locate all .JPG files no matter where they are on the hard drive and move them [not copy] to a specified folder titled "JPG PHOTOS" that is on my desktop. I am then going to move that folder with all of the images to an external hard drive.


I am very new to scripting.

MacBook Pro (13-inch Mid 2009), iOS 6
  • Neville Hillyer Level 4 Level 4 (1,845 points)
    Currently Being Moderated
    Oct 23, 2012 11:42 AM (in response to CEStryker)

    The fastest and most reliable is to use to search names for jpg. Then select all (cmd A) and drag to desired location.


    Alternatively use Finder to search for jpg extension and drag to new location.

  • Neville Hillyer Level 4 Level 4 (1,845 points)
    Currently Being Moderated
    Oct 23, 2012 12:54 PM (in response to CEStryker)

    My test showed that a file type search is rarely necessary as I had no names containing jpg.


    Am I correct in thinking that you wish to maintain the original sub-structure within your new folder?

  • Neville Hillyer Level 4 Level 4 (1,845 points)
    Currently Being Moderated
    Oct 23, 2012 3:29 PM (in response to CEStryker)

    You do not say how many files or duplicates are involved but here is a simple bash script which you can paste into Terminal and then hit return.


    find "/Users/neville" -name "*.JPG" -exec mv -n {} "/Users/neville/All JPG Photos" \;



    1. Make a full backup before you do this - mv can be dangerous
    2. A simple mistake - such as not creating the destination folder can destroy files
    3. This is not a copy script it moves files - so original path information will be lost
    4. Change source and destination as required
    5. May have to do it again for jpg
    6. The -n  ensures nothing is overwritten
    7. Do it repeatedly with slightly different destinations to get duplicates
    8. The script could be modified to auto-renumber duplicates - GNU bash has a 'backup' option for this
    9. If there are a large number of JPG files a batch modification may be required


More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.