Move to "old" folder

This is my first attempt at building an Automator workflow. I’ve spent some time looking through the forums for specific solutions, but being a noob I’m not finding the answer I’m looking for. I thought I’d give it a go here and see if anyone had any suggestions.

I’m looking for a way to automate a very mundane task that’s performed quite often throughout my day. I’m constantly making revisions to photoshop files and saving new versions out, leaving the old ones to be placed (manually) into an “old” folder within my “images” folder. A lot of times there are hundreds of images within my working folder, so it’s often a hassle to go digging for the “old” folder. I’d like a way to be able to select the old image(s) and automatically move it to the “old” folder within the current working directory.

Thanks in advance for helping a “noob”.



easiest solution:
copy this code into Script Editor, save the script as application bundle somewhere.

tell application "Finder"
	set dest to (insertion location as text) & "old:"
	repeat with oneFile in (get selection)
			move oneFile to folder dest
		on error e
			display dialog e
		end try
	end repeat
end telll

Open a Finder window and drag the icon of the application next to the search field.
Then open your folder, select files and click on the application icon


Thanks so much for your response. That worked great! What would you recommend as a good starting point for learning scripting of this sort? I’d like to understand more.

BTW, in testing this I discovered a situation where this script errors out. Sometimes I’ll have a finder window open (List view) to the root of all my jobs and I’ll be viewing files from within a nested folder. Since the script is looking at the root of the finder window (which doesn’t contain an “old” folder), the script errors out. Is there a way to set the destination to the “old” folder within the folder of the originating selection? At this point it’s just a matter of curiosity and not a big deal. If I can’t find a way to make it fool-proof, I’ll just be sure to always be in the root folder of my working files.

Thanks again Stefan. You just made my life a LOT easier.


a good point to start is to read the tutorials in the unscripted section of MacScripter

this is another version of the script.
You can specify a list of parent folder names (nameList) and corresponding child folder names (folderList).
If the pair exists the files will be moved otherwise just nothing happens

property nameList : {"Desktop", "Documents"}
property folderList : {"old", "new"}

tell application "Finder"
	set loc to insertion location
	set dest to ""
	set locName to name of item (loc as text)
	repeat with i from 1 to (count nameList)
		if item i of nameList is locName then
			set dest to ((loc as text) & item i of folderList & ":")
			exit repeat
		end if
	end repeat
	if dest is not "" and (exists folder dest) then
		repeat with oneFile in (get selection)
			move oneFile to folder dest
		end repeat
	end if
end tell