Yesterday, I posted about making the switch from Ulysses to Pages. Today, I’m posting about doing something wicked cool—at least from the perspective of someone who really doesn’t know what she’s doing.
I wanted my Pages documents stored in my iCloud Drive, since that’s what makes it so incredibly easy for me to work with those files, no matter where I’m working from or on which platform. But I also wanted the peace of mind that comes with having those documents backed up by Dropbox.
I didn’t want to work very hard for those backups, however.
I didn’t want to have to save a file in two locations every time I made a change, and I didn’t want to have to keep track of which files had and hadn’t been updated.
So, I did some reading, and came across mentions of something called “rsync”. If you—like the poor, ignorant me who existed several hours ago—have no idea what rsync is, keep reading, because that’s about to change:
It’s a command, run via Terminal on the Mac1, that syncs folders. The ins and outs of it don’t really matter too much for what I wanted to do, so I can’t tell you more than that. There’s plenty of information on the internet, though, and I’ll even help out with some handy links in just a bit.
You should try this out by working with files and folders that don’t matter to you. Please, please, please, don’t risk your nearly-finished 90,000-word manuscript based on my instructions! They’re bad instructions! Bad! I played with folders created just for sussing out what I was doing, and made sure that worked before trying to sync what I actually wanted to sync. (I also made sure I had a separate backup of my Pages documents before trying to sync them for the first time. You should do so, as well.)
Because my knowledge of the subject consists solely of what I needed to know in order to do what I wanted to do, I’m going to get right to it.
In Terminal, on your Mac, type the following:
rsync -avztcp filepathforfolderyouwantsynced/ filepathforfolderyouresyncingto
(Note the trailing slash at the end of the first file path. Without that slash, the folder, itself [rather than just its contents], pops up inside the folder specified by the second filepath.)
You’ll have to “escape” any spaces inside either filepath with a backslash. For example:
Hit the enter/return key, and whatever files you have stored inside the first folder should be synced to the second folder.
But it’s still a lot of work, having to remember the “-avztcp” bit (especially if you aren’t sure what that means)2, but also having to copy, paste, and modify the filepaths every time you want to sync.
I made a TextEdit file of the entire, properly formatted thing, from the command to the end of the second filepath, so that all I’d have to do is copy and paste once per sync, but that’s still an awkward workaround.
I toyed with Automator a bit, but found it to be too complicated for what I wanted to do.
Especially when AppleScript makes it super-easy!
Poking around a bit online led me to “do shell script”. That particular bit of AppleScript lets you run Terminal commands from the application or script that you’re creating in Script Editor. Follow it up with whatever it is you want to run in Terminal (within quotes, please, thanks), and you’ve reduced your workflow to double-clicking an icon on the desktop.
The problem is that AppleScript wants you to escape your escape, so anywhere you’ve escaped a space by adding a backslash, you need to add another one:
The entire thing in Script Editor should look like this:
do shell script "rsync -avztcp filepathforfolderyouwantsynced/ filepathforfolderyouresyncingto"
do shell script "rsync -avztcp /Users/setup/Desktop/sample\\ folder/ /Users/setup/Desktop/sample\\ folder2"
Run the script. Make sure it does what you want it to do, then save it to your Script Editor folder in iCloud Drive.
Once that’s done, export the script to your desktop as a run-only application. This will be your happy little sync button, just waiting to be double-clicked!
Find an awesome icon to go with the awesome thing you’ve just created, just to make clicking it that much more fun. (I went with the Ghoul icon from Anthony Piraino’s Creeps set.)
After that’s done, it’s time to strut around the house quoting Vanilla Ice to your SO:
If there was a problem
Yo, I’ll solve it
Then go give a look to all of the the articles and posts below, because you’ve taken enough advice from someone who’s unqualified to give it: