1

I noticed that in recent versions of macOS, aliases I create are smaller than they used to be. I have a folder full of old aliases whose sizes range from 50 KB to 6 MB, but new aliases seem to be always less than 1 KB.

I want to recreate all my large, old aliases to save disk space. I know I can update an individual alias by finding the file the alias points to, deleting the alias, and option-command-dragging the original to where the alias was. However, this loses the Date Created of the alias, and more steps are needed to preserve the name of the alias if it is different from the original file. Also, this would take too long to do for my hundreds of aliases. How can I shrink my aliases in bulk while preserving the name and Date Created?

There is another, very similar question Recreate an alias with the same name and timestamp programmatically. The difference is that that question requires an answer that doesn’t change the Date Modified of the alias. I am fine with the Date Modified being updated, as long as the Date Created is unchanged.

2 Answers 2

1

On macOS 10.14 Mojave, inspecting any individual legacy alias with Get Info (I) causes it to be regenerated with a smaller size.

To use Get Info to regenerate aliases in bulk, first show a list of the aliases to update in Finder in List View. To find all your aliases, press Space to open a new search in Finder, click ‘+’ to add an criterion, and set the criterion to “Kind” is “Other”, typing in “Alias”.

In this list of aliases in Finder, select the top result, then press I to Show Inspector. The selected alias will be regenerated – you will see its size go down. Now hold down the ↓ arrow key to select each alias one at a time. Each of them will be regenerated, getting an updated Date Modified but keeping its Date Created.

You have to inspect each alias one at a time because inspecting multiple aliases will only update the first one.

0

Here is a rather efficient solution using AppleScript. In Script Editor.app/Preferences, select the option to "Show Script Menu In Menu Bar" & "Show Computer Scripts"

enter image description here

Then paste this following AppleScript code into a new script editor document. Then save that new AppleScript document as a .scpt file to this following location...

/Users/YOUR SHORT NAME/Library/Scripts/

Basically this AppleScript code will take the selected alias files in your front Finder window and create new alias files to the location of your choice. If this save to location is different than the location of your current alias files, you will be given the option to delete your original alias files. This code will maintain the creation date of the original files, however the modification date will be the date that the alias files were created.

tell application "Finder" to set oldAliasFileList to selection as alias list

set theOriginalFiles to {}

repeat with oldAliasFile in oldAliasFileList
    try
        tell application "Finder" to set end of theOriginalFiles to ¬
            (original item of oldAliasFile) as alias
    on error errMsg number errNum
        display dialog "Some Item In Your Finder Selection Is Not An Alias File
 Or Its Original Item Cannot Be Found" buttons {"Cancel", "OK"} default button "OK"
        return
    end try
end repeat

activate
set theFolderChoice to display dialog ¬
    "Choose A Destination Folder For Your New Alias Files" buttons ¬
    {"Cancel", "OK"} default button "OK"

if button returned of theFolderChoice is "OK" then
    activate
    set aliasFileDestinationFolder to (choose folder)
else
    return
end if

repeat with thisFile in theOriginalFiles
    tell application "Finder"
        set {creationDate, modificationDate} to {creation date, modification date} of thisFile
        set aNewAliasFile to make new alias file ¬
            at aliasFileDestinationFolder to thisFile ¬
            with properties {creation date:creationDate, modification date:modificationDate}
    end tell
end repeat

activate
set deleteOldAliasFiles to display dialog ¬
    "Would You Like To Delete The Old Alias Files?" buttons ¬
    {"Cancel", "DELETE"} default button "DELETE"

if button returned of deleteOldAliasFiles is "DELETE" then
    tell application "Finder" to delete oldAliasFileList
end if

enter image description here enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .