Using Automator to copy files to external SSD

Hi. Is there a way of using Automator to automatically copy any files or folders added to one location to another?


I have all my music files stored on an external SSD. If I add anything to that music folder I want Automator to copy it to a backup folder I have on another external SSD. I assumed this would just be a simple folder action but all I've been able to get it to do is copy the source file (and everything in it) to the other drive. That folder is already there and I just want anything new to be copied into it when it's added to the main folder in the other drive.

Mac mini, macOS 13.3

Posted on Apr 17, 2023 6:04 AM

Reply
Question marked as Top-ranking reply

Posted on Apr 17, 2023 8:20 PM

I would approach the task a bit differently. Use the venerable rsync command which is specifically designed for this scenario.


  1. Install Homebrew from https://brew.sh
  2. Then brew install rsync to install the latest version which is much newer than what Apple ships in macOS
  3. Verify the correct rsync by issuing the commands "which rsync" and "rsync --version" it should not be version 2.6.9.
  4. Learn about rsync (google it -- Linux rsync is the same) and try a mirror command to work from source to destination. But if that doesn't do what you want you can just copy the files to the backup location. See the options mentioned below that are specific to macOS ACL's (Access Control List preservation)
  5. When you've got a command with options that works you can create a Launchd plist to run every few minutes so it will constantly be mirroring the content from folder A to folder B. Mirror will remove files that were deleted from folder A in folder B. Otherwise you can use the options below which is merely copying the files.


% rsync -rlAXtgoD --fake-super /source/ /destination
                                      ↑ super important slash at end of source path

Summary of options:

#  -r                   recursive; recurse into directories  
#  -l                   copy symlinks as symlinks  
#  --acls, -A           preserve ACLs (implies --perms, -p)  
#  --xattrs, -X         preserve extended attributes  
#  -t                   preserve modification times  
#  -g                   preserve group  
#  -o                   preserve owner  
#  -D                   preserve devices and special files  
#  -v                   increased verbosity; may be repeated  
#  -i                   itemize changes  
#  --fake-super         store/recover privileged attrs using xattrs (for ACLs & XATTRs)  
#  --dry-run            perform a trial run with no changes made


This document describes how to create a launchd XML plist to run a command every few minutes.

https://www.maketecheasier.com/use-launchd-run-scripts-on-schedule-macos/



Similar questions

1 reply
Question marked as Top-ranking reply

Apr 17, 2023 8:20 PM in response to Dazza76

I would approach the task a bit differently. Use the venerable rsync command which is specifically designed for this scenario.


  1. Install Homebrew from https://brew.sh
  2. Then brew install rsync to install the latest version which is much newer than what Apple ships in macOS
  3. Verify the correct rsync by issuing the commands "which rsync" and "rsync --version" it should not be version 2.6.9.
  4. Learn about rsync (google it -- Linux rsync is the same) and try a mirror command to work from source to destination. But if that doesn't do what you want you can just copy the files to the backup location. See the options mentioned below that are specific to macOS ACL's (Access Control List preservation)
  5. When you've got a command with options that works you can create a Launchd plist to run every few minutes so it will constantly be mirroring the content from folder A to folder B. Mirror will remove files that were deleted from folder A in folder B. Otherwise you can use the options below which is merely copying the files.


% rsync -rlAXtgoD --fake-super /source/ /destination
                                      ↑ super important slash at end of source path

Summary of options:

#  -r                   recursive; recurse into directories  
#  -l                   copy symlinks as symlinks  
#  --acls, -A           preserve ACLs (implies --perms, -p)  
#  --xattrs, -X         preserve extended attributes  
#  -t                   preserve modification times  
#  -g                   preserve group  
#  -o                   preserve owner  
#  -D                   preserve devices and special files  
#  -v                   increased verbosity; may be repeated  
#  -i                   itemize changes  
#  --fake-super         store/recover privileged attrs using xattrs (for ACLs & XATTRs)  
#  --dry-run            perform a trial run with no changes made


This document describes how to create a launchd XML plist to run a command every few minutes.

https://www.maketecheasier.com/use-launchd-run-scripts-on-schedule-macos/



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.

Using Automator to copy files to external SSD

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