Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

macOS difference of file alias vs unix link

Hello,


I'm currently working on a small backup process using rsync but I have incorrect results on aliases when using the option rsync -a or -l for aliases created via finder: the destination aliases cannot be read or are showing incorrect data


After digging, I realise that the finder does not set the type "link" when I create an alias through the finder


For example: I Create a plain text file:

>$ echo "base file" > BaseFile.dat
>$ ls -l
total 8
-rw-r--r--@ 1 <user>  staff  10 Nov 18 11:52 BaseFile.dat
>$ 

1) Create a link via terminal shows a link to the original file

>$ ln -s BaseFile.dat LinkFile.dat
>$ ls -l
total 8
-rw-r--r--@ 1 <user>  staff  10 Nov 18 11:52 BaseFile.dat
lrwxr-xr-x  1 <user>  staff  12 Nov 18 11:57 LinkFile.dat -> BaseFile.dat
>$ 

2) Creating an alias via Finder does not anymore show the link in Terminal (But it does in the finder or CMD-I )

>$ ls -l
total 16
-rw-r--r--@ 1 <user>  staff   10 Nov 18 11:52 BaseFile.dat
-rw-r--r--@ 1 <user>  staff  936 Nov 18 11:59 BaseFile.dat alias
lrwxr-xr-x  1 <user>  staff   12 Nov 18 11:57 LinkFile.dat -> BaseFile.dat
>$ 


Both alias or link are showing "Alias" in the finder kind of file… but the size are not the same.


This induces incorrect results in rsync since the destination file generated for the aliases originated via Finder cannot be handled.


What is the difference between an alias and a link?



Jean


MacBook Pro (15-inch, 2016)

Model Identifier: MacBookPro13

Processor Name:Quad-Core Intel Core i7

Memory: 16 GB


System Version: macOS 10.15.1 (19B88)


Posted on Nov 18, 2019 3:53 AM

Reply
Question marked as Best reply

Posted on Nov 18, 2019 6:03 AM

I find explanations on https://eclecticlight.co/2019/01/05/aliases-hard-links-symlinks-and-copies-in-mojaves-apfs/

and in SO https://stackoverflow.com/questions/32428806/preserving-aliases-over-osx-ssh-rsync the options to use in rsync


rsync -E


which provides the extended attributes of macOS


Kind Regards

Similar questions

1 reply
Question marked as Best reply

macOS difference of file alias vs unix link

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.