Automator or AppleScript for file management folder actions?

Automator or Applescript for folder actions?


I would like to start setting up some automation for managing files using my MacBook Air (OS 12 Mavericks). It would be a bonus if I could use the same automation on my MacBook Pro (OS 10.9 Mavericks) too. Am I better off trying to set this up using Automator or Applescript? Is there a good way to learn how to do this? Or where can I find ready to use scripts or automator actions?


Some examples of things I'd like to try to set up.

  1. folder action to sort selected files or files in selected folder into designated folders by filetype.
  2. connect to the other computers on my home network (e.g. sign into the MacBookPro and Mac Mini with my username and password)
  3. sync selected 2 folders on the MacBookAir and MacBookPro
  4. rename selected files and append a date or suffix based on some attribute such as file saved date


In the past, I dabbled a teensy bit with folder actions using Applescript on my MacBookPro (OS 10.9 and earlier). For example I set up a folder ("A") that I could drop scanned images into that would 1) run a "quartz filter" and re-save the smaller file in a different folder ("B") and 2) move the original scan into a third folder ("C"). That was more than 10 years ago and I don't recall how I did that.


About 5 years ago, somehow I managed to create an automator folder action that would copy a file from a folder ("Y") to different folders on 2 connected volumes on another computer on the network. The problem with that folder action is that I always had to manually log onto the other computer first before it would work.


I had/have other Apple scripts that I downloaded from places like Doug's Applescripts for iTunes or Scriptbuilders. I still use these when I'm using the older MacBook Pro.


Any advice would be appreciated.

Posted on Jan 13, 2026 7:45 PM

Reply
Question marked as Top-ranking reply

Posted on Jan 14, 2026 12:31 PM

> Am I better off trying to set this up using Automator or Applescript?


Intergalactic wars have been fought over smaller questions :)


Seriously, though, that's a tough one.


Automator is 'easy', with its drag-and-drop approach, but that comes at a cost. Simple, linear things that have predefined application support are straightforward, but as you add complexity (if/then logic, loops, error handling), it really breaks down.

Automator's also good at building some of the more esoteric kinds of automation, which you can see when you start a new Automator workflow:



Ignoring Workflow and Application, it's a little easier to setup the other kinds of workflows in Automator (vs. AppleScript) since Automator adds the relevant headers, and saves the script in the appropriate place (e.g. Folder Actions, Quick Actions, etc). These can generally be done in AppleScript, but they take a little extra work.



AppleScript, on the other hand, gets to a lower-level with a much broader set of tools and commands, far more flexibility, but with a steeper learning curve. You have to know a little more about the application you're targeting, to know what objects and commands it understands. AppleScript isn't going to do that work for you, but once you understand that, the sky is the limit.


Both should be transferrable between your systems, so there shouldn't be a problem there. Long term, though, it seems clear that Apple's focus is more on the Automator/Shortcuts approach than AppleScript, since AppleScript hasn't seen a major update in a while. That's not to say it's going away any time soon, but there's no AppleScript in iOS, and MacOS and iOS do seem to be converging, so...?


For me, personally, I highly prefer AppleScript, but I'm probably considered Old School at this point :)

I will use Automator for things like Print Plugins and Quick Actions, because these tend to be simple, linear, one-off kinds of things, but for anything else AppleScript is my go to.


> Is there a good way to learn how to do this?


Honestly, I think both approaches lack any serious tutorials, how-tos, or training. Maybe it's hard because they're so open-ended. A good place to start would be https://macosxautomation.com/ which has links to various AppleScript, Automator, and other resources. There's also https://www.macscripter.net/ which is a pretty active community of scripters helping out each other.


> Or where can I find ready to use scripts or automator actions?


Both the above resources would be places to start, but beware the everyone's needs are a little different, so you're not likely to find a perfect match to your needs. Hopefully, though, you can 'get close and tweak', which is how many of us got started :)


If you do take the AppleScript path, do yourself a favor and get a copy of the (now free) Script Debugger 8 from https://latenightsw.com/ It's leaps and bounds ahead of Apple's Script Editor and is a must for any serious AppleScripter.


/... more follows

Similar questions

4 replies
Question marked as Top-ranking reply

Jan 14, 2026 12:31 PM in response to Marlinespike

> Am I better off trying to set this up using Automator or Applescript?


Intergalactic wars have been fought over smaller questions :)


Seriously, though, that's a tough one.


Automator is 'easy', with its drag-and-drop approach, but that comes at a cost. Simple, linear things that have predefined application support are straightforward, but as you add complexity (if/then logic, loops, error handling), it really breaks down.

Automator's also good at building some of the more esoteric kinds of automation, which you can see when you start a new Automator workflow:



Ignoring Workflow and Application, it's a little easier to setup the other kinds of workflows in Automator (vs. AppleScript) since Automator adds the relevant headers, and saves the script in the appropriate place (e.g. Folder Actions, Quick Actions, etc). These can generally be done in AppleScript, but they take a little extra work.



AppleScript, on the other hand, gets to a lower-level with a much broader set of tools and commands, far more flexibility, but with a steeper learning curve. You have to know a little more about the application you're targeting, to know what objects and commands it understands. AppleScript isn't going to do that work for you, but once you understand that, the sky is the limit.


Both should be transferrable between your systems, so there shouldn't be a problem there. Long term, though, it seems clear that Apple's focus is more on the Automator/Shortcuts approach than AppleScript, since AppleScript hasn't seen a major update in a while. That's not to say it's going away any time soon, but there's no AppleScript in iOS, and MacOS and iOS do seem to be converging, so...?


For me, personally, I highly prefer AppleScript, but I'm probably considered Old School at this point :)

I will use Automator for things like Print Plugins and Quick Actions, because these tend to be simple, linear, one-off kinds of things, but for anything else AppleScript is my go to.


> Is there a good way to learn how to do this?


Honestly, I think both approaches lack any serious tutorials, how-tos, or training. Maybe it's hard because they're so open-ended. A good place to start would be https://macosxautomation.com/ which has links to various AppleScript, Automator, and other resources. There's also https://www.macscripter.net/ which is a pretty active community of scripters helping out each other.


> Or where can I find ready to use scripts or automator actions?


Both the above resources would be places to start, but beware the everyone's needs are a little different, so you're not likely to find a perfect match to your needs. Hopefully, though, you can 'get close and tweak', which is how many of us got started :)


If you do take the AppleScript path, do yourself a favor and get a copy of the (now free) Script Debugger 8 from https://latenightsw.com/ It's leaps and bounds ahead of Apple's Script Editor and is a must for any serious AppleScripter.


/... more follows

Jan 14, 2026 12:32 PM in response to Camelot

> folder action to sort selected files or files in selected folder into designated folders by filetype.


For a simple Folder Action, I'd say use Automator. However, you added the gotcha of needing to sort files by type, and that requires conditional execution which is Automator's achilles' heel. For that reason alone I'd go AppleScript.


Also, you mix your terminology, so you need to understand what you're asking for...


"folder action"

to

"sort selected files"


This is not a Folder Action ask.

Folder Actions are special format scripts that are run automatically in the background when a folder is changed in some way. Folder Actions don't care about what's 'selected' (other than indirectly, since you generally select a file to move it into/out of a directory), but Folder Actions would also fire off when you save a file from within an application, or even when you open or close the folder window in the Finder, so it may be that what you want isn't a folder action after all. A Folder Action would only be useful here if you're dropping files into a folder.


If you want a (bare bones) example of an AppleScript approach to this, here's one:


-- start by defining the sorting folders - these folders must exist
property ImagesFolder : "Macintosh HD:Users:Username:Sorted:Images"
property MoviesFolder : "Macintosh HD:Users:Username:Sorted:Movies"
property OtherFolder : "Macintosh HD:Users:Username:Sorted:Other Files"

-- and a list of appropriate file types
property image_filetypes : {"jpg", "gif", "png", "tiff"}
property video_filetypes : {"mov", "mp4", "m4v"}

on open of theFiles
	--	Executed when files are dropped on the script
	repeat with aFile in theFiles
		tell application "Finder"
			-- assume 'other' file type
			set targetFolder to OtherFolder
			-- find out what kind of file we have
			set filename_extension to name extension of aFile
			-- does it match an image type to filter?
			if filename_extension is in image_filetypes then
				set targetFolder to ImagesFolder
				-- or a movie file?
			else if filename_extension is in video_filetypes then
				set targetFolder to MoviesFolder
			end if
			-- by the time we get here, we know how to filter this file, so lets move it
			move aFile to folder targetFolder
		end tell
		
	end repeat
end open


Save this as an Application. Now you can drop any files on this application and it will sort them based on image/movie/other file types.


I say it's bare-bones because there's no error checking (do the destination folders exist?), there's limited file type checking (based purely on filename extension), no consideration of recursion (what happens if a folder is dropped?), and no checking if there's a filename conflict in the destination (the file has already been copied?), but it'll give you an idea, and you can add the parts that are important to you.



> connect to the other computers on my home network (e.g. sign into the MacBookPro and Mac Mini with my username and password)


Assuming you mean connect to a shared folder on the destination server, this is something that Automator has an action for, and it's straightforward - do this. No questions, no if/then/else, no loop, so you might as well do this in Automator, but it's also simple in AppleScript:


mount volume "afp://MacBookPro.local/FolderName" as user name "Bob" with password "supersecretdonttellanyone"


(If you omit the 'with password" parameter it will prompt you at runtime)


/... even more follows

Jan 14, 2026 12:33 PM in response to Camelot

> sync selected 2 folders on the MacBookAir and MacBookPro


Nightmare. Run away now.

Seriously. syncing is no joke, and there are a kajillion and three ways it can go wrong.

I'm not aware of an Automator Action to sync directories, so you're down to AppleScript. The issue is that are are SO many ways to consider 'synching'. What constitutes a match? if two files with the same name exist, which one is 'right'? do you depend on file dates? sizes? do you rename one of the files? do you copy both ways. And more.


If you're confident in the rules you want to impose, then it's possible, with work, but if this is at all serious, then get some additional software that is designed to deal with all the corner cases, and have that do the work.

Now, you may be able to incorporate some third-party app into an AppleScript workflow, so you can still automate it, but what seems like a simple 'sync' question is absolutely, 100% guaranteed to stir up a hornet's nest. Don't try to reinvent the wheel.


If you're comfortable with the command line, there is a command-line utility rsync which can take care of most of this, and you can invoke a shell script via do shell script... in AppleScript, or the Run Shell Script action in Automator. Just don't try to do the heavy lifting in AppleScript or Automator.


> rename selected files and append a date or suffix based on some attribute such as file saved date


Run away from Automator. Seriously. I can already hear the evil laughter and see the demons rubbing their hands together in glee just at the thought of you trying to introduce this kind of logic and conditional processing into a workflow. Automator will break you and all those you love.

This is relatively easy in AppleScript. Identify the file(s) to rename, define the renaming rules, rename the file. done.


Here's an example:


-- ask the user for a file to rename
set fileToRename to (choose file)

tell application "Finder"
	-- get the file's name
	set file_name to name of fileToRename
	-- and its filename extension
	set filename_extension to name extension of fileToRename
	-- get its modification date
	set last_modified_date to modification date of fileToRename
	-- and extract month/day/year
	set date_string to last_modified_date's {month, day, year}
	-- format the date into something filename-safe
	set {old_tid, my text item delimiters} to {my text item delimiters, "-"}
	set date_string to date_string as text
	set my text item delimiters to old_tid
	-- construct a new file name. This can be as complex as you like
	--in this example I strip the existing filename extension off the file name, append the date string, and reapply the filename extension
	set new_filename to (characters 1 through -((count filename_extension) + 2) of file_name) & space & date_string & "." & filename_extension as text
	try
		set name of fileToRename to new_filename
	end try
end tell


Jan 15, 2026 8:01 AM in response to Camelot

Hi Camelot,


I think you may have been someone who helped me in the past when I was tinkering with Applescript. Thanks for the detailed reply, examples, and links! I will have to spend time with this to try things out. I've already downloaded the script editors for both newer and older Macs.


>Intergalactic wars have been fought over smaller questions :)


hahaha :D I think the "controversy" is why I got confused trying to get back to this automation project. From what you say it seems like Applescript will be the way to go for more complicated tasks and maybe Automator for simple things or one time use cases. I tried using Shortcuts on my iphone but find it to be extraordinarily confusing. Worse is that even the shortcuts from the gallery don't seem to work. :(


Regarding syncing: I used to use CarbonCopy Cloner for syncing things but the new versions are paid and no longer donationware. I am comfortable with using command line so may look into that with rsync.


Thanks again for the help! I may be back to this thread with questions once I try out your scripts over the weekend.

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.

Automator or AppleScript for file management folder actions?

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