/ howto

os x: automatically move files using folder actions

previously, i used noodlesoft's hazel to move files freshly downloaded to a different directory. additionally it was very useful in a workflow i described earlier. in the following sections you'll see how to setup folder actions aligned to the already mentioned workflow (take a moment to check it out--i'll wait here for you).

icon of os x's finder

please open finder and navigate to (create any folder, which doesn't exist):

~/Library/Scripts/Folder Action Scripts

icon of script editor

create a new script and paste this code (remembers to change your username):

property ignoreList : {"bts", "btsv"}
property destinationFolder : "Macintosh HD:Users:florian:Desktop"

on adding folder items to this_folder after receiving added_items

	repeat with currentFile in added_items

			tell application "Finder"
				if name extension of currentFile is not in ignoreList then
					move currentFile to destinationFolder
				end if
			end tell
		end try
	end repeat

end adding folder items to

it should look like this:

screenshot of script editor with the above mentioned script

save the script to ~/Library/Scripts/Folder Action Scripts and name it like move Recorder item to Desktop.scpt.

finder screenshot with context menu

back in finder navigate to the folder, receiving incoming files (path from my workflow: ~/Public/BTSync/recorder), do a context click (right click) and navigate to Services - Folder Actions Setup.

screenshot of folder actions setup

from the drop down menu, which automatically opens, choose move Recorder item to Desktop.scpt.


main picture by roman drits, license