Hundreds of filepaths reference to one genuie file I have one file,to which hundreds of filepaths reference to.

In [96]: len(paths_list)
Out[96]: 191
In [97]: paths_list
Out[97]:
['~/Desktop/Dev/sample.txt',
 '~/Library/Containers/com.apple.CloudPhotosConfiguration/Data/Desktop/Dev/sample.txt',
 '~/Library/Containers/com.apple.PressAndHold/Data/Desktop/Dev/sample.txt',
 '~/Library/Containers/com.apple.iCal.CalendarNC/Data/Desktop/Dev/sample.txt',
 '~/Library/Containers/com.apple.languageassetd/Data/Desktop/Dev/sample.txt',
 '~/Library/Containers/com.apple.photos.VideoConversionService/Data/Desktop/Dev/sample.txt',
 '~/Library/Containers/com.apple.iCal/Data/Desktop/Dev/sample.txt',
 '~/Library/Containers/com.apple.share.Video.upload-Youku/Data/Desktop/Dev/sample.txt',
 '~/Library/Containers/com.apple.QuickTimePlayerX/Data/Desktop/Dev/sample.txt',
 '~/Library/Containers/com.apple.PassKit.PaymentAuthorizationUIExtension/Data/Desktop/Dev/sample.txt',
 ...]


They are of the same file.

What's the mechanism behind it?
There happens to be symbolic links which puts your ~\Desktop folder in each Data folder. So if you execute the command shown below, the output will contain many printed lines. Most of these lines will show a path through a Data/Desktop symbolic link. Note, the -L option causes the find command to follow symbolic links.

find  -L  ~  -name  sample.txt  -print


If you execute the command given below, the same output will be produced, minus the lines showing a path through a Data/Desktop symbolic link.

find  ~  -name  sample.txt  -print


The output from the above command should contain at least the following line.

/Users/YourUsername/Desktop/Dev/sample.txt


A symbolic link is just a file containing a character string. Each directory entry for such files contains a flag indicating the file is a symbolic link. The character string stored in a symbolic link file can be printed by executing the readlink command. For example, you could enter the following command, on your computer.

readlink  ~/Library/Containers/com.apple.CloudPhotosConfiguration/Data/Desktop


This would produce the following output.

../../../../Desktop


So when symbolic links are being followered and the file name

~/Library/Containers/com.apple.CloudPhotosConfiguration/Data/Desktop/Dev/sample.txt


is encountered, the Desktop string gets replaced by the string ../../../../Desktop to produce

~/Library/Containers/com.apple.CloudPhotosConfiguration/Data/../../../../Desktop/Dev/sample.txt


which is equivalent to the

~/Desktop/Dev/sample.txt


file name.