![]()
If you look at the script above, I called one of the intermediate files TEMPFIFO. Lastly I'll mention one final mystery that maybe some reader can solve. But better yet, just stick with the cpio archives. Yuck, and this is left as an exercise to the reader. 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 creates a cpio archive, then use ditto to unarchive this. #MACZIP A FOLDER ARCHIVE#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 don't 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 won't quite work if the you give it a full path to some_dir on the command line. I use ditto to first create a cpio archive then I use ditto to unpack it in a resource-unaware manner, leaving the. Again, this saves the meta-data in AppleDouble format. #!/bin/bash TEMPDIR=`mktemp -d` || exit 1 TEMPFIFO=`mktemp -p $TEMPDIR` & mkdir $rm -fr $TEMPDIRTo use this on some_folder, type tar_hfs.sh some_folder > some_folder.tgz. Save the following into a file called tar_hfs.sh and make it executable ( chmod a+x tar_hrs.sh). But in case you want to, here is a script. #MACZIP A FOLDER HOW TO#You don't really need to read further, but you might be interested is seeing how to use these tricks to make a tar gzip archive that has resource forks! Well it's not pretty and it's hard to undo. Strangely, ditto does not work in this case - I'm guessing this is a bug, since it should work. On an HFS system, you recover the resource forks from the cpio archive using ditto again: % ditto -x -rsrc some_folder.cpio some_folder_destinationTo recover the resource forks on a pkzipped file, you have to use StuffIt Expander. #MACZIP A FOLDER MAC OS#It does restore the resource forks on Mac OS if you have a UFS partition or a mounted NFS drive, however. Therefore, don't use cpio to unarchive on an HFS file system. However, when you do this on an HFS file system, it fails to restore the resource forks to the right files. On an OS X machine, you can extract the archive using cpio also, and you will see these same AppleDouble files. Note that not all files have meta-data, so you may not see this AppleDouble format file for every regular HFS file. _somefile which contains all the meta-data and resource forks. In this folder you may now observe that for each file some_file that has meta-data, there will be an associated file named. For example, on any unix machine (besides OS X), to open a cpio archive type: % cpio -i -I -z some_folder.cpio and it will unarchive it in the current folder. #MACZIP A FOLDER WINDOWS#If you send this file to a unix or Windows person, they can open these using cpio and pkzip, respectively. To create a pkzip archive of "some_folder" type: % ditto -c -k -X -rsrc some_folder some_folder.zipAlternatively, to create a compressed cpio archive type: % ditto -c -X -z -rsrc some_folder some_folder.cpioBy 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). ![]() The latter is tricky to create and to undo, so I dont reccomend it but the method is instructuve so I'll describe it anyhow. Fortunately you can use ditto to make both PKZIP (Windows) and compressed Unix archives that preserve the resource forks! There are three types of archives you can produce: pkzip, cpio-zipped, and tar-zipped. Panther's new archive maker is HFS aware, but it's not compatible with Stuffit or tar and zip. HFS files have meta-data and resource forks that are lost during common unix archive operations like cpio, tar, gzip. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |