Use AppleScript to Quickly Change File Names

UPDATE: See how to do this in Snow Leopard or Lion

One of my favorite tools in Mac OS X is AppleScript. Now I am by far no expert at AppleScript, and in fact I have never even written a script. But I do use them all the time, and my favorite feature is the script menu. This is a great little menu item that lists all of your AppleScripts in the OS X menu bar. With the scrips always just a click away, I find that I use them much more often and really increase my productivity.

To turn on the script menu go into your Application folder > AppleScript > AppleScript Utility. Select the check box for Show Script Menu in menu bar. You should now see the script menu in your menu bar.

replacenames-5.png

Now that you have your script menu installed, you will have easy access to the Finder Scripts that we will use in the next example.

If you deal with a large number of files that you need to rename on a regular basis, you are going to love this tip. We will use a standard AppleScript called “Replace Text in Item Names”. Basically it will take a group of files or folders and perform a find and replace on their names. While there may be a million different reasons to use this script, a common one, and one that I deal with a lot, is to rename a series of screen grabs.

  1. Find the location of the files or folders that you want to rename.
  2. Go to the script menu and into Finder Scripts.
    replacenames-1.png
  3. Select “Replace Text in Item Names”.
  4. You will be prompted to select File Name or Folder Name. Select which ever you would like to change.
  5. Enter the text that you would like to replace.
  6. Enter the new text.
    replacenames-2.png
  7. You will receive a confirmation notice. Select Ok, and you are done.
    replacenames-4.png

Make sure to take a look at the other Finder scripts, as you may also have a use for them.


1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5.00 out of 5)
Loading...



13 Responses to “Use AppleScript to Quickly Change File Names”


  1. 1 Brian Nov 22nd, 2006 at 3:05 pm

    You have nice How-To articles, so I would like to know if you would be interested in joining the MadMac team. Please reply to me by email.

  2. 2 Matthew Wilson Feb 26th, 2007 at 7:35 am

    Thanks, just changed from PC to Mac and changing file and folder names was driving me insane!

  3. 3 Mario Nov 1st, 2007 at 8:05 am

    Thanks!
    Your tip was very useful!

  4. 4 Karen Jan 2nd, 2008 at 5:03 pm

    Happy New Year!

    Even happier since I found your site. Yep, same here, had to move across to a different platform and needed to change 8,597 file names to do it. Applescript did it with 3 key strokes! Thank you so much.

    Sugoi!

  5. 5 Michael Aug 26th, 2008 at 11:18 am

    …nice tip but cannot do recursively :-(. Thank you.

  6. 6 Matt Dec 12th, 2008 at 1:06 pm

    This is GREAT! But how can I use the TRIM FILE NAMES script to remove ANYTHING beyond a certain character count?

    We have file names like:
    12345 blah blah blah
    23457 blah blahhha blahh

    We want to keep the first 5 digits, but remove everything past this.

    Is there a wildcard we can use?

    Can this be modified to search within sub-folders?

    THANKS!

  7. 7 Beth Jul 2nd, 2009 at 11:16 am

    This is a huge timesaver!
    However, is there anyway to apply it to subfolders?
    Or after searching for specific items applying it to all found items?

    We are cleaning up our server and need to remove all unusual/punchtuations characters such as &#$! etc…

    Thanks!

  8. 8 Lloyd Oct 5th, 2009 at 3:34 am

    Thanks – a great tip.

  9. 9 Mike Puckett Jan 6th, 2010 at 10:05 am

    I could not get this to work, but did figure out that simply selecting the file and hitting the Enter key immediately makes the file name editable……

  10. 10 Brian Oct 20th, 2011 at 8:56 am

    I’ve used this for years and really love it, but the pre made scripts don’t seem to be there in the new 10.7 Lion. Any idea what the script is so I can remake them on my own? Specifically “add to name – prefix”.

  11. 11 Jared Picune Oct 23rd, 2011 at 9:50 am
  12. 12 GPS Tracker Oct 25th, 2011 at 10:19 am

    Is there a keyboard shortcut to change a file name? Like option click or something? I just downloaded a jpeg image and want to change the name of the image.

  1. 1 Use AppleScript to Quickly Change File Names « The Picune Blog Pingback on Nov 22nd, 2006 at 12:27 pm
Comments are currently closed.