Let us develop a utility to batch process legacy alias files.
Implemented as:
- Finder File Service,
- Automator Workflow,
- Applescript,
- Shellscript,
- or whatever else that those the job.
Per each file in the batch this should be done:
- Is the file an alias? (avoid other file types supplied by user error)
- Get its filepath, filename, timestamp, label, tags.
- Delete it.
- Recreate it at the original filepath with the determined filename, timestamp, label, tags.
Followup: I filed a bug report to Apple, see below. Maybe Apple comes up with a solution. But I think some skilled AppleScripter(s) here can come up with a solution within minutes. Would be cool, if we find a solution here, and offer it to the whole macOS community.
Bug report to Apple, filed on 2017-01-10
Finder / HFS+ / filesystem — Refreshing legacy alias files to reduced filesize with batch process
A LONG LASTING BUG WAS LUCKILY FIXED:
In macOS Sierra the file size of aliases was finally reduced dramatically, from multiple megabytes in Mac OS X 10.7-10.11 systems down to only about 1 KB now in macOS Sierra 10.12. (Simply by not including the icon resources, which where mostly anyhow redundant being just a copy of a generic file type icon.)
PLEASE OFFER A FIX FOR THE BUG LEGACY AS WELL:
Depending on how heavily aliases are used on a system, there is the potential to save multiple GBs for some users.
I propose to Apple to offer a batch process for reducing the file size of legacy alias files. With an option to preserve the aliases' original timestamps, as they may have critical information value in some use cases.
Then you could do a simple Finder search, select the files of your liking (all or only certain) and then drag'n'drop them onto the batch process app or file service or Finder menu command.
CURRENT WORKAROUND WITH QUICKLOOK ONLY WORKS PARTIALLY
- Finder > New window (cmd-N) > Search (cmd-F)
- The search criteria show up, set them as follows:
- "Kind" is "Other", type in "Alias"
- You get a Finder search result window.
- View as list and sort by size.
- Then you have the top file size culprits on top.
- If you QuickLook a file via SPACE-key then no alias recreation occurs.
- Issue "File > Show Original" (cmd-R) on the selected file.
- In the newly opened window, QuickLook the alias files with SPACE.
Then certain alias files get recreated. But not all!
Working, but only sometimes: PDF, JPEG, ZIP if BetterZip QuickLook plugin is the handler.
Out of these not all aliases get refreshed.
It seems to also depend on the file's overall or individual associated application (Finder "Open with" setting, Uniform Type Identifier (UTI), TYPE/CREATOR resource fork) and which QuickLook plugin handles the file type.
An recreated file has a dramatically reduced file size (bout 1 KB). Sadly it looses its original timestamp, but gets the current one (equivalent to /usr/bin/touch). I would love to keep the alias timestamp preserved.