Using TAR on file alias

aicul

Registered
Hello,

I am having a little problem with the TAR command.

I want to TAR some files for archiving. The archive will include general directories, subdirectories including files and some alias to files also included in the TAR.

I have used the TAR -c -j -v -f archive.tar * command.

What I have noticed is that when I restore the files using TAR the alias files are restored as "zero byte" files. Hence I lose the alias link.

Is there somethin obvious I am doing wrong, or does TAR not work with alia files?
 

lurk

Mitä?
The problem is that tar does not do resource forks IIRC. Alias information is stored in the resource fork of those files and is lost. I would suggest making a compressed disk image to archive to, that will preserve all of info you are looking for.
 

aicul

Registered
Thanks for the technical clarification.

I would like to use a compressed image but these files remain far bigger (by 100's of Mb) than a TAR -j (bzip2) compressed file.
 

lurk

Mitä?
Can you use unix symlinks instead of aliases? They are tar friendly and still work in finder.
 

aicul

Registered
I tried the unix symlinks (ln -s .. ..) and these work in finder and tar does reproduce them correctly. Unfortunately the symlink recreated by tar is broken.
 

scruffy

Notorious Olive Counter
well, a symlink is a link to an absolute or relative file path, not to a file - unlike aliases, which survive if you move the original around. Take away or move the original, and the symlink breaks. Restore a symlink on a system where the original is missing, and it will break.
 

lurk

Mitä?
Yep, all the symlink does in encode the path of where to go. You can get pretty far with them if you engineer things right. For instance, use ../../../foo/bar.baz to move up and then over in the directory structure. Use absolute links where appropriate.

There are not 100% interchangeable with aliases. One way to think of it is that aliases capture the identity of the object and symlinks capture the location. For some purposes these are the same and for others you want one or the other.
 
Top