I am not referring to traditional symlinks in general, but specifically to the "alias" files used within iCloud Drive. I am also not referring to "stub" files that indicate that a file has not yet been downloaded from the cloud. These are specialized macOS alias files (yes, aliases) that point to files elsewhere in iCloud Drive. They're the files mentioned in this Apple discussion forum thread.
When a file in iCloud Drive is opened with an application, an alias (i.e., a file that "points" back to the original) is created in the iCloud Drive folder corresponding to the application used to open the file (unless the file is stored in that app's folder). For instance, I created a Keynote presentation called
Intro to Git and stored it in
~/Documents (which corresponds to
~/Library/Mobile Documents/com~apple~CloudDocs/Documents in the iCloud Drive hierarchy). I then opened it in Keynote. The original file stayed in
~/Documents; however, an "alias" was generated and stored in
Keynote's iCloud Drive folder (
~/Library/Mobile Documents/com~apple~Keynote/Documents, or
iCloud Drive >
Keynote in Finder).
When I view the file in
~/Documents, it looks like this:
In other words, the original file is stored in
Documents. However, within the
Keynote folder, there is an alias file generated by iCloud Drive (note the
in Documents text, indicating that this is not just a regular alias, but one automatically generated by iCloud Drive and detected by Finder):
Having these aliases is particularly convenient, as it creates a single location from which I can open various documents editable in a certain application that may be stored throughout my iCloud Drive file system. However, I cannot seem to trigger the creation of aliases for several new spreadsheets I have made, all of which are stored in iCloud Drive but not in the Numbers folder. I've tried adapting the strategies mentioned in the PDF Viewer and MindNode support documents on this topic (Apple has none), including opening the documents in Numbers on both Mac and iOS, to no avail. Based on what those documents say, it seems that the alias should automatically created when I open the document in Numbers for the first time, but that is not the case.
I do not want to create a regular file alias in the Numbers folder (which I could do by holding command and option while dragging, or using
Make Alias). Instead, I would like to trigger the generation of an iCloud Drive-specific alias (such files' actual names follow the format
.########-####-####-####-############.alias, where each
# represents a hexadecimal digit) in the Numbers iCloud Drive folder. How can I accomplish this?
I'm running macOS High Sierra 10.13.6 and iOS 11.4.1. I'm using the latest versions of Numbers and Keynote on both as of the time of writing, but this is not an application-specific question.
Edit: A hexdump of both the specialized iCloud alias and a regular alias to the same file indicate that these iCloud aliases are more than just a special file name—they also contain additional information. Specifically, there's an additional section in the alias file following the text
NSURLDocumentIdentifier, which contains
docs.icloud.com:com.apple.CloudDocs/[hexadecimal string]. There's also a
_NSURLParentDirectoryIDKey that doesn't exist in the normal alias file. Moreover, these iCloud aliases are readable by iOS devices—normal alias files (for obvious reasons—they're pointing at a file on the Mac's local file system) aren't readable on iOS.