ZeTreze
February 8, 2012, 5:33pm
#1
Tried this under automator topic and got no luck with responses or it is not possible.
I would like to be able to add text to the existing name of the folder based on the name of the files inside.
Example:
Folder name:
RENDER A1:
Files Inside the folder:
Image_001_METAL-TEXTURE.jpg
Image_002_WOOD-TEXTURE.jpg
I would like to run a script that would rename the folder:
RENDER A1 METAL
This will be very handy since I am managing thousands of folders and I can sort and group them later based on the new renamed folder names.
Thank you in advance.
sbriss
February 8, 2012, 8:33pm
#2
Hi there is a way to do this with applescript but here is a software not very expensive that is very handy for renaming files and folder. I recommand it.
http://www.publicspace.net/ABetterFinderRename/index.html
StefanK
February 8, 2012, 8:34pm
#3
Hi,
this is probably possible, if there is an unique assignment.
For example how does the script know you want RENDER A1 METAL and not RENDER A1 WOOD ?
ZeTreze
February 8, 2012, 11:49pm
#4
I would assume that in the same script there is a search criteria where will indicate:
If find METAL - add name METAL to RENDER A1
and opposite if you find WOOD - add name WOOD to RENDER A1.
Is this possible?
Thank you
StefanK
February 9, 2012, 8:52am
#5
What should happen if the folder contains metal and wood?
And is the material information (metal or wood) always between an underscore and a hyphen?
ZeTreze
February 9, 2012, 3:28pm
#6
Thank you for taking intereste in this project.
It will always have an underscore
This is the workflow scenario that I have in mind:
Folder name:
RENDER A1:
Files Inside the folder:
Image_001_METAL_TEXTURE.jpg
Image_002_WOOD_TEXTURE.jpg
RENDER B1:
Files Inside the folder:
Image_003_METAL_TEXTURE.jpg
Image_004_WOOD_TEXTURE.jpg
Apple script action:
If files inside the folder contains text “_METAL” (I would like to be able to specify the word)
Than add text to end of the folder"_METAL"
End Result
Folder name:
RENDER A1_METAL:
Files Inside the folder:
Image_001_METAL_TEXTURE.jpg
Image_002_WOOD_TEXTURE.jpg
RENDER B1_METAL:
Files Inside the folder:
Image_003_METAL_TEXTURE.jpg
Image_004_WOOD_TEXTURE.jpg
Thank you
StefanK
February 9, 2012, 4:31pm
#7
Try this
property searchTerm : "_METAL"
set baseFolder to choose folder
tell application "Finder" to set subFolders to folders of baseFolder
processFolders(subFolders)
on processFolders(theFolders)
repeat with aFolder in theFolders
tell application "Finder"
set subSubFolders to folders of aFolder
set metalFiles to (files of aFolder whose name contains searchTerm)
if (count metalFiles) > 0 then
set aFolderName to name of aFolder
set name of contents of aFolder to aFolderName & searchTerm
end if
end tell
processFolders(subSubFolders)
end repeat
end processFolders
ZeTreze
February 9, 2012, 8:41pm
#8
This is great.
Stefan THANK YOU SO MUCH.