:lol:
Hi there, please help if you can.
I’ve got several thousand files I need to process which are within various folders. They all have an eight digit code and then some form of extension usually after a dash (-) which is followed by the document type eg: 00056198-Spec Sheet.pdf 19908449-Core Artwork.ai 09902349-Core Artwork.eps etc.
There could be one file with the eight digit code or 4 or six all with different extensions.
What I want to do is move the files to another folder, take the eight digit code, make a new folder with this code and put those files with that code in it - so on and so forth…but I can’t get it to work.
I’m new to scripting (first attempt) and have trawled the net looking at other scripts (much appreciated) but haven’t got anything to work.
I’ve started with this script to test working with just one file but can’t get it to work.
on adding folder items to theFolder after receiving stuff
tell application “Finder”
with timeout of 500 seconds
repeat with aFile in myFiles
set folder_name to name of aFile --gets the name of the file
if length of folder_name > 8 then
set folder_name to (text 1 thru 8 of folder_name)
make folder with properties {name:folder_name} at theFolder
move aFile to folder {name:folder_name}
end if
end repeat
end timeout
end tell
end adding folder items to
I thought of using it as Folder Action and drop the files on to the folder so it could go and do the work, but it is to no avail. It’s probably quite simple but the answer escapes me. It’s the first time I’ve seriously looked at scripting something and I’ve found a new interest in it as I wasn’t aware so much could be done with it - however my interest is quickly getting replaced with frustration.
If anyone can help it would be greatly appreciated.
Many Thanks
DaddyCool76 (or not so cool when it comes to scripting!) [/b]