MacOS – Turn off Aliases in iCloud Drive

icloudmacos

When I browse into an iCloud Drive folder (specifically Preview.app's folder) via Finder on OS X 10.11.1, I see both the files I knowingly placed there and the ones I opened with the related app, Preview in this example, which got automatically aliased in there.

To me, it's just clutter, useless. I'm thinking perhaps a workaround script or toll running periodically as a cron jobs could wipe out the aliases in the specified locations?

Is there a (hidden/unofficial)way to turn-off this behaviour of iCloud Drive that it doesn't create aliases? If not, has anyone a tool/script that would be the start of something I could adopt to clean the folders?

Best Answer

I would advise against deleting the aliases since the design is to place them there. Since the entire cloud folder is synchronized you're fighting a losing battle when those aliases come back from the cloud or from the process that creates them. As a bonus, you already have one copy of those files stored elsewhere in iCloud drive, so perhaps you could make progress by moving the file so that it lives in preview rather than the other folder.

If you look in terminal - you will see that all the .alias files are hidden with a . to start the name and you could easily script deletion of these files with AppleScript, Automator, Hazel, cron with something as blunt as

rm ~/Library/Mobile\ Documents/com~apple~Preview/Documents/.[ABCDEF0123456789]*\.alias

I've tested that while looking at brctl log -w on OS X 10.11.1 (15B42) and the system seems to not misbehave and propagated the deletion up to the cloud properly, but I can't say I'd be comfortable with automating the deletion to run continuously or even regularly.