Skip navigation

How can Automator or Applescript rotate 500,000 images in folders and subfolders.

1801 Views 31 Replies Latest reply: Dec 4, 2012 4:58 PM by adayzdone RSS
  • twtwtw Level 5 Level 5 (4,580 points)

    Oooo, good point.  It would probably be ok since it's reusing the same openedFile variable (that should automatically release the last image data), but to be on the safe side ludwip could replace the save line with the following:


      close saving yes

    that would definitely avoid any such problems.  He might even want to add the following lines to the on error section:



                close openedFile saving no

      end try

    which will try to close any opened image in the event of an error.

  • twtwtw Level 5 Level 5 (4,580 points)
  • twtwtw Level 5 Level 5 (4,580 points)

    well, I just ran it on a copy of my entire pictures folder from the script editor and it worked fine.  You didn't mention you wanted to run this from an app, and I suspect any app you run it from is going to look like it's frozen - applescript isn't threaded, so it will just chug away unresponsively until it's done, which may take a while.


    if you want to be sure it's working and not frozen, you can add some audio feedback.  set i to 0 before the repeat loop, then add in a vocal counter before the end repeat statement.


              set i to 0

              repeat with thisImageFile in fileList

      --  yaddayaddayadda


                        set i to i + 1

                        if (i mod 300) = 0 then

                                  say (((i * 1000) div (count of fileList)) / 10 & " percent done") as text

                        end if

              end repeat

  • twtwtw Level 5 Level 5 (4,580 points)

    just comment out the display dialog line (seventh line from the end, add two dashes (--) at the front of the line). The scirpt will still mark missed files in the finder, but won't put up a dialog that has to be dismissed.

  • adayzdone Level 2 Level 2 (150 points)



    Did this not work?


    set mainFolder to "/Users/ludwip/Documents/My Folder"

    do shell script "find " & quoted form of mainFolder & " \\! -name \".*\" -type f -print0 | xargs -0 sips -r 90"

  • twtwtw Level 5 Level 5 (4,580 points)

    sips handles only the following formats (from its man page):


    jpeg | tiff | png | gif | jp2 | pict | bmp | qtif | psd | sgi | tga


    if you feed it the wrong kind of file it will throw an error, any I've never understood xargs well enough to know what it will do if the utility it's running throws an error.


    THe find command he's using will find every file that happens to have an extension; are their any other types of files in that directory?

  • adayzdone Level 2 Level 2 (150 points)

    Happy to help twtwtw correctly points out that the command will try to process all files in the main directory. (which do not start with . )    You can change the find command to limit the scope to files that end with jpg, etc.

  • adayzdone Level 2 Level 2 (150 points)

    Like this:


    do shell script "find " & quoted form of mainFolder & " -iname *.jp*g -o -iname *.pdf -o -iname *.tiff"


    .jp*g matches jpg or jpeg


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.