Putting It Together

Suppose you want to round up all the recently modified files related to your Yosemite project, compress them into a single archive, and copy them to your iDisk. How would you go about it?

You could, of course, use the Finder’s Find command to search for all files modified today that have “Yosemite” in their names. Next, you would select the found files from the search results window and drag them onto the icon of DropStuff icon—which (oh, right!) you had the foresight to add to your Dock or desktop from the Applications (Mac OS 9)Internet UtilitiesAladdin folder. You would then need to go online and choose GoiDisk to bring your iDisk’s icon to the desktop. Finally, you would drag your newly created Yosemite.sit file into the iDisk’s Documents folder.

If you were especially clever, you might remember that the Backup program that came with your .Mac account could automate the uploading part of this ritual—but not the finding part.

But if you’d gained some mastery of Unix, you could shave 12 minutes off of your workday just by typing this:

set f = 'date +%m%d.tar.gz' ; find ~ -type f -iname '*yosemite*' 
-mtime 1 -print0 | xargs -0 gnutar -czf $f ; curl -T $f http://
idisk.mac.com/coast_photo/Public/

Even after two chapters of Unix basics, that mass of commands probably looks a tad intimidating. And, indeed, if you’ve never programmed before, even the following breakdown may make your eyes glaze over. But even so, pieces of it should now look familiar.

  • set f = ‘date ...

Get Mac OS X: The Missing Manual, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.