I’ve done some searching around the forum and haven’t had much luck on trying to find something that might work for what I am trying to accomplish. Would love to get your alls feedback.
Right now I process out jpgs with a certain 10 digit style number, sequential number and color. Sometimes they have multiple angles which is the issue I’m running into because it can be 2,3,4,5, or 6 different numbers per style number.
Is it possible to have a script that searches for all the different style numbers in finder and then creates a folder based on the first 10 digits of that filename? Also Is it possible for the script to take that group of numbers and move them to that the folder it creates.
Thanks so much.
Ryan
Here is a screenshot of what it looks like once I’ve processed all my jpgs.

Hi,
easiest version, ditto creates intermediate directories automatically
set sourceFolder to choose folder with prompt "Choose source folder containing the images"
set destinationFolder to POSIX path of (choose folder with prompt "Choose destination base folder")
tell application "Finder" to set theFiles to files of sourceFolder whose name extension is "jpg"
repeat with aFile in theFiles
set fileName to name of aFile
set prefix to text 1 thru 10 of fileName
do shell script "ditto " & quoted form of POSIX path of (aFile as text) & space & quoted form of (destinationFolder & prefix & "/" & fileName)
end repeat
Wow. Very awesome Stefan!!!
Do you know of anything that will move them into the folder that it creates? Sometimes I will have 200-300 images to drag and drop the jpgs into.
Thanks once again.
Run the script, but it copies the files !
haha. totally didnt check inside the folder it created. Just saw that it had created them. Spoke to soon.
this is a version which moves the files
set sourceFolder to choose folder with prompt "Choose source folder containing the images"
set destinationFolder to POSIX path of (choose folder with prompt "Choose destination base folder")
tell application "Finder" to set theFiles to files of sourceFolder whose name extension is "jpg"
repeat with aFile in theFiles
set fileName to name of aFile
set prefixFolder to destinationFolder & text 1 thru 10 of fileName
do shell script "mkdir -p " & quoted form of POSIX path of prefixFolder
do shell script "mv " & quoted form of POSIX path of (aFile as text) & space & quoted form of prefixFolder
end repeat
Thanks so much Stefan. We ended up adding some necessary script to make it run the way we needed it to. But you got us started with a great base. Thanks 