AppleScript help needed

Discussion in 'Mac Apps and Mac App Store' started by rendezvouscp, Jun 29, 2004.

  1. rendezvouscp macrumors 68000

    Aug 20, 2003
    Long Beach, California
    I'm working on an AppleScript right now, and I'd like to be able to add ".jpg" to all of the files in a folder. How do you apply an action like that to make it a folder script? Thanks in advance.
  2. tomf87 macrumors 65816


    Sep 10, 2003
    It may be easier to use Terminal. Something like this from


    Here's modification of their code for your use:

    for fn in `find . -type f | grep -v '.jpg' | grep -v ''`
    mv $fn `basename $fn.`jpg

    This will modify all filenames in current folder and subfolders, except for anything that has .jpg or in the filename, and append .jpg to them. I named my script so that's why it is in there. If you want AppleScript to launch this shell script, use, assuming is in a folder named bin in your home directory:

    do shell script "~/bin/"

    Save this as an AppleScript under /Library/Scripts/Folder Action Scripts

    Now you should be able to select that in Finder for that particular folder.

    DISCLAIMER: This script has been tested minimally, and I am under no liability for any result or action this script may do. I highly recommend testing this on a temporary directory before actual use.

Share This Page