Applescript rename a file when put in a folder

Discussion in 'Mac Programming' started by DesertStorm, Oct 14, 2011.

  1. DesertStorm, Oct 14, 2011
    Last edited: Oct 14, 2011

    DesertStorm macrumors newbie

    Joined:
    Oct 14, 2011
    #1
    Hi, guys.

    I have a little problem to solve with AppleScrip and counting on your help. It is all about batch renaming files, but with a twist :p

    How do you write a folder action script so that it would rename the file you put in it to a set of numbers (something like 0001 but without changing its file extension) and did it sequentially, i.e. so that if you already have the 0001 file in there, the next file would be named 0002 and so on.

    I have some experience in programming but am a total noob in AppleScript, so even some guidelines would help.

    Thanks!
     
  2. DesertStorm thread starter macrumors newbie

    Joined:
    Oct 14, 2011
    #2
    OK, correct me if I'm wrong, but the general scheme would look something like that:

    1. Check for adding an item to the destination folder
    2. Count the number of files in the destination folder
    3. Change the name of the item being added to "the number of files in the destination folder" + 1

    Any suggestions?
     

Share This Page