Script Editor - Remove first 3 characters from all filenames in folder A and move to folder B

Hi! I could really use some help writing a script that will help me manage my files for a specific project.


I have folder A, which has a few hundred files that all look like:

001TimCook.jpg

002CraigFederighi.jpg

003EddyCue.jpg

and so on...


I need the first 3 characters removed from the filenames, and then move all files to folder B.


Result:

TimCook.jpg

CraigFederighi.jpg

EddyCue.jpg

and so on...


I know there are a lot of people in here that are a lot more clever than me and I'd just like to say thank you in advance for the help! It will save me an astronomical amount of time compared to doing this manually every day.

Posted on Nov 7, 2023 10:09 AM

Reply
Question marked as Top-ranking reply

Posted on Nov 7, 2023 10:21 AM

Use code such as:


tell application "Finder"

repeat with this_file in (get files of folder "folder1" of desktop)

move this_file to folder "folder2" of desktop

set name of the result to (items 4 thru -1 of (get name of the result)) as string

end repeat

end tell


(246695)

2 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Script Editor - Remove first 3 characters from all filenames in folder A and move to folder B

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.