Apple Automator: Difference between revisions
Line 6: | Line 6: | ||
== Batch rename == | == Batch rename == | ||
[[File:Rename-Finder-Items.png|thumb|350px|right|Service rename files]] | [[File:Rename-Finder-Items.png|thumb|350px|right|Service rename files]] | ||
The Automator.app has allowed batch-renaming files, but it has always been pretty slow, because it created PowerPC binaries. | The Automator.app has allowed batch-renaming files, but it has always been pretty slow, because it created PowerPC binaries. <ref>[https://kkaefer.com/note/batch-rename-on-lion/ Konstantin Käfer], Author of the Batch rename article. | ||
Fortunately, in Mac OS X 10.7, Automator.app got really fast, making it a lot more useful. | Fortunately, in Mac OS X 10.7, Automator.app got really fast, making it a lot more useful. | ||
* Start ''Automator'' and create a new '''Service'''. | * Start ''Automator'' and create a new '''Service'''. |
Revision as of 08:22, 28 April 2013
Automator is a funny tool, but a good tutorial of using it is lacking. I really miss some good Automator tutorials online. It's such a great and I guess underrated and underused tool. Here I'll show you how to combine it with rsync to easily synchronise two folders. I have looked on the Internet to find good tutorials and decided to collect the best ones.
Batch rename

The Automator.app has allowed batch-renaming files, but it has always been pretty slow, because it created PowerPC binaries. Cite error: Closing </ref>
missing for <ref>
tag, but with a few enhancements to make errors less severe. The script describes real mic what and how you can use Automator to script you results
The script uses the UNIX rsync command [1]. Please take care in using this script. It may be dangerous to use.
- Start Automator application and choose the Workflow as template for your Workflow.
- Add the action Ask for Finder Items from the category Files & Folders or use the search option to find it.
- Change the text of the Prompt field into Choose a folder to synchronize from.
- Select the folder for the Start at field into your folder of choice.
- Change Type into Folders.
- Add action Set value for Variable and give the variable the name source_folder.
- Now ctrl-click (or right click) on the text field and select Ignore input from the popup-window.
- Repeat Step 2: Add the action Ask for Finder Items
- Change the text of the prompt into Choose a Target folder.
- Repeat Step 4: Add action Set value for Variable and give the variable the name target_folder.
- Add action Ask for Confirmation
- Change the prompt into Synchronizing from .
- Drag the Variable source_folder into the prompt field.
- and the text to
- Drag the Variable target_folder into the prompt field.
- Again, ctrl-click (or right click) on the text field and select Ignore input from the popup-window.
- Now add Get Value of Variable for the source_folder and add Ignore the input.
- Again add Get Value of Variable for the source_folder and add Ignore the input.
- Add the action Run Shell Script. Add the following text:
if [[ -z $1 ]] ; then echo "Invalid choice for Source ($1), aborting" exit -1 fi if [[ -z $2 ]] ; then echo "Invalid choice for Target ($2), aborting" exit -1 fi rsync -va "$1/" "$2/"
- Please not that you can add the option --delete to the rsyc, but don't do that in the first test run.
See also
- Apple AmcOSX Automator Examples Workflows.
Reference
- ↑ Linux.die.net, man page for rsync.