0
votes

I'm new to Applescripts but i used VB.net alot in the past and could do this easily with VB.net, however i am restricted to using Applescript at the moment as i dont have access to vb.net.

We handle a lot of images at the auctioneers where i work and need to rename all these images inside their folders to allow us to mass upload the images.

So we have folders from 1 to around 600 called "1" to "600", which would represent Lot 1 or Lot 600 in the sale, inside these folders we have about 7 .jpg images of that lot, with the main image being called "Main.jpg" (this is renamed to "Main" manually as i edit the image on photoshop as only the main image needs editing)

The goal of this coding venture is to have all the contents of all the folders from 1 to 600 with the "Main.jpg" file being renamed to the lot number, i'll show an example of what i mean below:

Old contents in folder "1":

img_001.jpg, img_002.jpg, img_003.jpg, Main.jpg

New Contents in folder "1":

1_1.jpg, 1_2.jpg, 1_3.jpg, 1.jpg

as this may be really simple for 1 to 10 folders trying to do this with 900 folders in the past has taken me 3 days using the manual rename right-click function on mac and i want to make a program which will allow me to automate this process, saving me a lot of time.

Any help will me massively appreciated

Haydon

1
this is pretty straight forward. you should at least show your aporoach to show you dont just need someone doing all work for you.Pat_Morita

1 Answers

0
votes

Pretty straight forward as Pat said. Here is just some entry points: First ask user to select the parent folder which contains all your folders :

set ParentF to choose folder "select your parent folder"
tell application "Finder" to set myFolders to every folder of ParentF

myFolders contains a list of all sub folders {"1", "2",...}. You need to loop through each folder of that list (search for "repeat" loops). for each folder, use again similar syntax to get all files in the folder :

tell application "Finder" to set myFiles to every item of AFolder whose name extension is "jpg"

Then again, loop through each file to change its name property.