Renaming files using the parent folder/directory name as a variable
Working for a catalog producer, while in the photo studio we generate hundreds of photos digitally. When the photography assistant goes to burn all photos taken on a day, she has to manually rename each jpeg with the SKU of the product it is for...this is so when the cd comes back to the office, the design team knows what photo goes with which product, as opposed to a cd with "Untitled_001", "Untitled_002".
Right now she names the parent directory with the SKU (ex. 123456) and drops all the photos in that directory as a product may be shot multiple ways, with and without models, etc. Is there a way to use Automator to have it batch process all the files and rename them with the parent directory's name and leave the underscore and number?
Automator does a basic "Find and Replace" but in the replace area it wants a specific name...I want to tell it to use a variable, i.e. use the name of the directory it's located in.
So it would go from:
123456/Untitled_001.jpg
To:
123456/123456_001.jpg
Does that make sense? In addition, I'd like it to apply ONLY to the filenames and not the foldernames...that is don't change the names of the parent folders, just the files underneath it. In addition, if there are nested folders in there, apply this action to ALL files underneath all the parent folder names.
I really don't want to have to get a 3rd party app to do this as it seems Automators should somehow be able to do this...no?
PowerBook G3 (Pismo), Mac OS X (10.4.6)