|
|
Undoing this, cpio, and tar archives
HFS files have meta-data and resource forks that are lost during common unix archive operations like cpio, tar, gzip. Panther's new archive maker is HFS aware but it's not compatible with Stuffit or tar-zip.
Fortunately you can use the To create a pkzip archive of "some_folder" type
Alternatively to create a compressed cpio archive type
by the way, although most people are more familiar with tar-zip, a cpio archive is a univerally compatible unix archive, and if anything is more versatile. (see man pages for cpio and pax for info).if you send this to a unix or to a windows person they can open these using cpio and pkzip, respectively. For example, on any unix machine (besides OS X) to open a cpio archive type:
and it will unarchive it in the current folder. In this folder you may now observe that for each file, "some_file", that has meta-data there will be an associated file named ._somefile which contains all the meta-data and resource forks. This is called appledouble format. Note that not all files have meta-data so you may not see this appleDouble format file for every regular HFS file. On an OS X machine, you can extract the archive using cpio also, and you will see these same appleDouble files. However when you do this on an HFS file system it fails to restore the resource forks to the right files. Therefore dont use cpio to unarchive on an HFS file system. (aside: it does restore the resource forks on mac OS if you have a UFS partition or a mounted NFS drive however). On an HFS system you recover the resource forks from the cpio archive using ditto again:
To recover the resource forks on a pkziped file you have to use stuffit expander. Strangely, ditto does not work in this case--I'm guessing this is a bug, since it should work.
ADVANCED STUFF
to use this on "some_folder" type
Again this saves the meta-data in appleDouble format. The method I use is a trick that uses ditto to first create a cpio archive then uses ditto to unpack it in a resource-unaware manner, leaving the ._somefile meta_data. Then I tar this. Note this trick winds up as an intermediate step, making a full copy of the folder you are trying to archive (it cleans up after itself), so dont do this on a nearly full disk! Also note that this script is for illustration purposes only and is not very general: it assumes that you are in the directory containing some_folder; it wont quite work if the you give it a full path to some_dir on the command line.Okay now how do I un-tar-zip this and restore the resource forks. To do this you need to un-tar-zip it then create a cpio archive, then use ditto to unarchive this. Yuck, and this is left as an excersize to the reader. But better yet just stick with the cpio archives. Lastly I'll mention one final mystery that maybe some reader can solve. I ran into in figuring this out. If you look at the script above, I called one of the intermediate files TEMPFIFO. This is because in my original script i used a unix fifo instead of a real file and backgrounded the first ditto command, figuring I could save some space and time. Oddly, about every ten or so tries the first "ditto" command issues an error message about not being able to complete the fifo. I have no idea why that error would happen. anyone know why? Al
Undoing this, cpio, and tar archives
oops a typo |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.09 seconds |
|