How to Send an Archive with Aliases

I have several files and aliases that point to them in a folder that I’d like to give to someone else.

If I zip the folder and give it to another Mac user, will the aliases still work on his Mac after he expands it?

If not, what technique for sending aliases do you recommend?

Thank you.

UPDATE 2022-12-10T05:36:00Z

Maybe my explanation of the archive isn’t clear, so let me try again.

The files are monthly bank statement PDFs for several different accounts and I want to organize the statements in two different ways:

  1. By year (using PDFs)
  2. By account (using aliases)


Filed by Year

2000 folder

2001 folder

Filed by Account

Account1 folder
2000-01-account1.pdf alias
2000-02-account1.pdf alias
2001-01-account1.pdf alias
2001-02-account1.pdf alias

Account2 folder
2000-01-account2.pdf alias
2000-02-account2.pdf alias
2001-01-account2.pdf alias
2001-02-account2.pdf alias

Account3 folder
2000-01-account3.pdf alias
2000-02-account3.pdf alias
2001-01-account3.pdf alias
2001-02-account3.pdf alias

Bonus Questions:

  • How does Migration Assistant handle aliases? Does the target computer get both the files and aliases that point to them, just like the source computer?
  • When restoring a full Time Machine backup, are the aliases restored as well as their corresponding files?

They should be. Aliases are just files that contain data that references other files. The references are stored in a variety of formats, some of which should remain valid after migrating to another device.

Can you just run a test? Make an archive, copy the zip file to another Mac, unzip it, and see what you get.

The short answer is that it might work but you will need to test what you want to do to be sure (i.e. zip up a folder with aliases, send it to a friend or yourself on another Mac, unzip, see what happens).

The longer answer is that the aliases might survive and might not, but there’s another way to achieve what you want to do that will definitely work but is more cumbersome. Mac aliases store the inode number of the target file, which has the nice property of allowing you to move the target file around on your disk or rename it and the alias will still point to it. This is because each file on a disk has a unique inode number, and it doesn’t change when the file moves or is renamed.

However, if you move the file to a different disk, it will get a new inode number and so the connection back to the alias breaks. However, if you try to follow an alias and the target inode doesn’t exist, MacOS will try to relink to the target by using the last known path to the file (an alias stores both the inode and path to the target file). So if you zip up a folder that has both the original files and the alias and then unzip it on a different disk, the aliases might work as MacOS will try and reconnect them and the relative paths between the targets and the aliases will be the same. However, it might not work if Mac aliases rely on absolute paths (from the root folder of a disk) instead of relative ones. I’m just not sure.

Your alternative option is to use Unix symbolic links (symlink). In the Finder they look the same as a Mac alias but work differently. A symlink is essentially just a text file with a path to the target file. That path can be absolute or relative depending on what you specify when creating it. Symlinks are ‘dumb’ compared to aliases: if you move or change even one character in the target filename, the symlink won’t work. Or if you rename the folder that the target file is in, the symlink will break. But they suit your use case well, because if you specify a relative path, it doesn’t matter where you move the files and symlinks to as long as the folder structure between them stays exactly the same (and you don’t rename any files). So you could have the following structure:

    2000 folder/

    2001 folder/

    Account1 folder/
        2000-01-account1.pdf alias  --> ../2000 folder/2000-01-account1.pdf
        2000-02-account1.pdf alias  --> ../2000 folder/2000-02-account1.pdf
        2001-01-account1.pdf alias  --> ../2001 folder/2000-01-account1.pdf
        2001-02-account1.pdf alias  --> ../2001 folder/2000-02-account1.pdf

    Account2 folder/
        2000-01-account2.pdf alias  --> ../2000 folder/2000-01-account2.pdf
        2000-02-account2.pdf alias  --> ../2000 folder/2000-02-account2.pdf
        2001-01-account2.pdf alias  --> ../2001 folder/2000-01-account2.pdf
        2001-02-account2.pdf alias  --> ../2001 folder/2000-02-account2.pdf

    Account3 folder/
        2000-01-account3.pdf alias  --> ../2000 folder/2000-01-account3.pdf
        2000-02-account3.pdf alias  --> ../2000 folder/2000-02-account3.pdf
        2001-01-account3.pdf alias  --> ../2001 folder/2000-01-account3.pdf
        2001-02-account3.pdf alias  --> ../2001 folder/2000-02-account3.pdf

This would definitely work if you zip it up and send it to someone else who unzips it on their end. However, the drawback is that you have to create symlinks in the Terminal, so it is somewhat cumbersome especially if you’re not familiar/comfortable with the command line.

~/Documents/statements/Account1 folder » ln -s "../2000 folder/2000-01-account1.pdf" "2000-01-account1.pdf alias"

So my recommendation is to try a test using standard Mac aliases – send an archive to the other person and see if MacOS manages to reconstruct the aliases with the path info they contain on their disk after they unzip it. That will be easiest for you. But if not you might need to use symlinks instead. And there are likely some Mac utilities that offer a GUI to create symlinks if you need. Maybe someone here can recommend one. It would also be fairly straightforward to write an AppleScript droplet to do this.

1 Like

I should have thought of this. Sorry. :man_facepalming:t2: