Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.6: Use Archive Utility to make zip backups System 10.6
Snow Leopard only hintFor those who don't trust Time Machine, backing up to archives manually can be tricky. First off, as of OS X 10.6.4, the Unix zip and unzip programs that you can start from a terminal shell script do NOT handle resource forks and extended attributes correctly. The zip man file has an apology that this will be implemented soon. (And Automator uses the Unix zip program.)

The tar archiver also does not handle extended attributes correctly. It also saves but does not restore resource forks. So that is not useful either.

It seems that the Archive Utility.app that makes archives for the Finder is ahead of the Unix zip and tar. It DOES handle resource forks and extended attributes correctly.

But using the Archive Utility from the Finder is clumsy and unreliable when there are several folders to archive. If you select a range of folders, and then right click one of them and select Compress, it will make one big zip file rather than individual zip files for each folder. But if you right click on one folder after another to archive them separately, the Finder gets confused and some of the archives quit with errors.

The only work around seems to be to wait for each archive to finish before starting the next. This can take hours of attention. Fortunately, there is a better way.
  • Navigate to /System/Library/CoreServices
  • Find Archive Utility.app and drag it to your dock
  • Single click on the Archive Utility.app icon in your dock
  • In the menu bar, navigate to Archive Utility » Preferences
  • Set the preferences as follows:
    • Save expanded files: into same directory as archive
    • After expanding: leave archive alone
    • Reveal expanded item(s) in Finder: check
    • Keep expanding if possible: check
    • Save archive: /Users/YOURNAME/YOURARCHIVEDIR
    • Use archive format: Zip archive
    • After archiving: leave files alone
    • Reveal archive in Finder: check
  • Close Archive Utility.app and navigate to /Users/YOURNAME
  • Command click to select folders A, B, C, ... , Z
  • Drag the group of selected folders and drop them on the Archive Utility icon in your dock.
The utility will make individual zip archives of A, B, C, ..., Z and place them in /Users/YOURNAME/YOURARCHIVEDIR. If there are more than four, the archive utility will make them four at a time.

It seems to handle the manipulation of multiple folders well -- no errors. These seem to be the same zip archives as would be made if you right clicked the folders A, B, ... , Z in succession in the Finder and chose Compress 'A', etc. individually. And it seems that the preferences you set in Archive Utility do not affect its behavior when used from the Finder right click menu.

[crarko adds: I haven't tested this one. This is the first I've heard that in 10.6.4 the version of zip mangles resource forks. Can someone confirm this? I think even if it's not correct, the hint itself still has utility.]
    •    
  • Currently 3.20 / 5
  You rated: 1 / 5 (10 votes cast)
 
[11,179 views]  

10.6: Use Archive Utility to make zip backups | 16 comments | Create New Account
Click here to return to the '10.6: Use Archive Utility to make zip backups' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: Use Archive Utility to make zip backups
Authored by: xcgr on Oct 05, '10 08:36:23AM

"ditto -c -k" will create zip archives that preserve resource forks and extended attributes. Run "man ditto" for details. I'd go that route instead of abusing Archive Utility. Then you can shell script it to suit your particular needs.



[ Reply to This | # ]
10.6: Use Archive Utility to make zip backups
Authored by: ekc on Oct 06, '10 10:18:09AM
I usually go with ditto -ck --sequesterRsrc to create the same type of zip files as the Finder. What sequesterRsrc does is it takes all those meta-data files (the ones beginning with ._) and sticks them in a separate directory called __MACOSX. That way they don't get in the way as much if you send your zip archive to a non-Mac user.

[ Reply to This | # ]
Why the Time Machine hate?
Authored by: dethbunny on Oct 05, '10 09:22:09AM

Why do so many people seem to be afraid of Time Machine? It's simple to set up and actually very reliable. (Before someone jumps in with an anecdote here, I'm in a position to see a lot of Macs, and TM has saved a lot of data. The only failures I have seen in the past two years were due to failed backup drives.)

If you want a secondary backup, why not use something simple and intended for the task like SuperDuper! or Carbon Copy Cloner?



[ Reply to This | # ]
Why the Time Machine hate?
Authored by: asmeurer on Oct 05, '10 09:26:24AM

I was wondering the same thing: why wouldn't you trust Time Machine? The only reason I can think of is that it isn't secure (encrypted), but this hint doesn't even address that.



[ Reply to This | # ]
Why the Time Machine hate?
Authored by: tedw on Oct 05, '10 10:45:04AM

It's a trust issue, I think. Time Machine is a prepackaged high-level utility. Some people feel more comfortable with the detailed control you get by implementing low level utilities, where you're always sure what's going on. For instance, I do my own backups using rsync rather than time machine (though in truth that's mostly because my backup drive has limited space - time machine is a bit of a disk hog).



[ Reply to This | # ]
Why the Time Machine hate?
Authored by: zpjet on Oct 05, '10 11:58:54PM

But even TimeMachine being "prepackaged high-level", it stores files in the most simple and smart way - using the hard links to do incremental backups. You can always find the files straight on the disk.

Which is the reason why it's the "disk hog" - it doesn't compress the files, but why, when prices of disks are going down every day?



[ Reply to This | # ]
Why the Time Machine hate?
Authored by: tedw on Oct 06, '10 01:38:45AM

true, but you can do the same thing with rsync, with more control and more transparency. if control and transparency are what you're after...



[ Reply to This | # ]
Why the Time Machine hate?
Authored by: Anonymous on Oct 06, '10 01:08:21PM

Time Machine is two things: 1. a frontend to an rsync-based archiver, and 2. a UI to navigate backups created by rsync.

It would be really very straightforward to use part 2 to navigate, and write your own #1 that does everything the same way as Time Machine.



[ Reply to This | # ]
Why the Time Machine hate?
Authored by: tedw on Oct 06, '10 01:52:58PM

Well, the problem with this, as I see it, is that I don't know how to use TM as a front end without setting it up to actually start making backups. if you design your own rsync thingee, I can't see any way to get it to work with TM. Plus, I personally use an updated version of rsync (rsync 3.0.x handles resources forks better than the 2.6.9 version that ships with leopard and snow leopard), but I don't know whether TM uses the system version of rsync or its own internal implementation, and I don't know what the changes in options keys from 2.6.9 to 3.0.x (which are noteworthy) would do to TM. that's just one of those black-box problems that comes from working with pre-structured interfaces.



[ Reply to This | # ]
Why the Time Machine hate?
Authored by: afingal on Oct 05, '10 11:03:56AM

I don't hate Time Machine but I do think it has some issues and limitations which need to be taken into account. I haven't seen anyone else either who actually hates Time Machine. Some people take complaints too seriously.

Time Machine lacks important options for controlling what to backup, where and how often. This creates a variety of both performance and privacy problems. Yes, there are a bunch of configurations you can do and third-party utilities which help but they are not simple and obvious for the average user.

One problem I have had personally is that Time Machine frequently corrupts the filesystem on the backup drive. I end up having to run Disk Warrior on it frequently. On the hardware side, time machine has also run two of my external drives into the ground because of how much read/write activity it creates backing up everything, every hour.

From the standpoint of a computer support provider, the biggest headache with Time Machine is that users think that Time Machine with an external HD is all they need and they don't make offsite backups. If you have a fire, flood, etc. the everything is gone. We had this happen. A plumbing leak on the floor above killed both the internal HD and Time Machine backup for someone where I work.

Don't get me wrong. I think Time Machine is a good option and I use it in spite of its shortcomings. However, I also use other things to make additional offsite backups (over the internet).



[ Reply to This | # ]
Why the Time Machine hate?
Authored by: agentx on Oct 08, '10 01:38:11AM

TM is Ok but is prone to issues and when a Logic board change sit is a bit of a nightmare to put right without creating a new TM backup.
It is far from sure when it does its backup "trimming" what is being deleted from backup !

I always use TimeMachienEditor with TM it allows control over backup schedules.



[ Reply to This | # ]
Why the Time Machine hate?
Authored by: ehahn on Oct 05, '10 11:04:51AM

It's not necessarily hate - I use the archive (zip) capability all the time, to put together packages of files for email or putting on an FTP site - not for backing up.

ed



[ Reply to This | # ]
10.6: Use Archive Utility to make zip backups
Authored by: afingal on Oct 05, '10 11:50:20AM

It's interesting that support for resource forks, etc. was added to tar in Tiger and then removed in Leopard. Before Tiger, I used a modified version called hfstar. In Tiger this became unnecessary because the built-in version worked and I thought I wasn't going to have to use hfstar again. Then in Leopard, I found that support for resource forks and hfs metadata was gone and I had to go back to hfstar. I wonder what happened. Why did Apple regress the functionality?



[ Reply to This | # ]
10.6: Use Archive Utility to make zip backups
Authored by: ekc on Oct 06, '10 10:03:57AM
Well, I don't have a Leopard machine on hand, but I just tested tar under Snow Leopard and it seems to save and restore resource forks. It's using the AppleDouble format internally from the looks of it. As an alternative to tar, you might consider xar which has always supported resources. I think Apple now uses that format internally in installer packages.

[ Reply to This | # ]
Why not make a Service with Automator?
Authored by: auco on Oct 06, '10 02:36:05AM

You can easily automate this in Automator. I have a Context Service in Finder, so I only select a file, right-click, choose the service and end up with an archive that has the current date as a postfix: myarchive_20101006-1135.zip

You can even choose if you want to move the archive to a certain directory, delete the sources and many other things. And it's really simple. If you're on SnowLeopard, 'Create new Service' is available in most context menus.



[ Reply to This | # ]
10.6: Use Archive Utility to make zip backups
Authored by: ojohns on Oct 07, '10 12:42:39PM

I just tested "ditto -ck --sequesterRsrc /Users/yourname/foo /Users/youruname/yourarchive/foo.zip" on a directory foo
containing files with both non-empty resource forks and metadata. Double-clicking on the resulting zip file in the
Finder does restore the original directory correctly. So, thanks for that comment.
(However, using the unix unzip in Terminal to unzip the zip file seems not to restore correctly. The __MACOSX directory
is kept separate. You have to restore using ditto, or the Finder, or Archive Utility directly.)

So, with ditto one can indeed make a shell script to do backups, or use Automator to make an
equivalent Services menu entry.

It looks like the Archive Utility might be a gui front-end for ditto, or maybe just reuses its code. I say that because,
in the Preferences for Archive Utility, the three choices for Use Archive Format (and their results) are:
compressed archive ---> cpgz archive
regular archive ---> cpio archive
Zip archive ---> zip archive
which are the same choices as those in ditto.

BTW, here's a quote from the zip man page in Snow Leopard 10.6.4, "Support for some Mac OS features in
the Unix Mac OS X port, such as resource forks, is expected in the next zip release." Maybe Apple has
abandoned upgrading the unix zip and unzip, and has moved on to use ditto instead?

---
ODJ



[ Reply to This | # ]