Mac OS X utility of the week – hfspax

[Original Link] This one is strictly for command-line hackers only…

Mac OS X comes with a variety of standard Unix tools that can be used for creating backups, mirroring directories etc, but most of them know nothing about the historical ‘features’ of the HFS+ filesystem, in particular the ‘resource forks’ traditionally associated with Mac files.

This means that backups created with tar, rsync, cpio etc will not necessarily restore all Mac files to a fully-working version. Some of the other included tools and some of the commercial alternatives also have limitations. The ditto command can handle resource forks but is pretty unsophisticated other than that.

Howard Oakley’s hfspax utility is a version of the standard pax command which knows about HFS and will back up files including their resource forks into standard cpio, tar etc archives, or into another directory. It also allows you to rename or exclude files based on regular expressions. I don’t want to back up onto my iPod anything containing ‘.Trash’ or ‘Cache’ in the filename, for example. It allows you to copy only updated files, only those on the same device, and so on. You can end up with some pretty complex command lines, but it will work, can be run from cron or anacron, and is free.

Howard doesn’t blow his own trumpet; there’s no documentation on the web site. Download the archive and look at the included docs.

© Copyright Quentin Stafford-Fraser