MacOS – Folder that automatically creates aliases

aliasapplescriptdockfindermacos

I like to save inspirational imagery in my dock. Since my Downloads folder is always a giant pile of files that I hoard and enjoy to go through every once in a while.
Now to save space in my Dock I’d have to have a folder as a stack where all those aliases to inspirational files are stored in. It would be nifty to be able to drag files into that folder and have the folder automatically create an alias of the file instead of moving it to there. That way I wouldn’t have to use shortcuts etc. and could simply drag files into there without actually moving them.

Understood? Maybe someone knows a solution. I’m guessing an AppleScript would be required. Let’s work together on this to make it happen.

Best Answer

Simply create a folder action script, move the scpt file to /Users/user_name/Library/Scripts/Folder Action Scripts and apply it to a folder:

The content of the script is:

on adding folder items to thefolder after receiving theAddedItems
    repeat with eachfile in theAddedItems
        tell application "Finder"
            make new alias file to eachfile at folder "Main_Volume_Name:Users:user_name:Desktop:Inspirational:"
        end tell
    end repeat
    repeat with eachfile in theAddedItems
        tell application "Finder"
            move eachfile to folder "Main_Volume_Name:Users:user_name:Downloads:"
        end tell
    end repeat
end adding folder items to

With Main_Volume_Name: the name of your volume (e.g. Macintosh HD – you don't have to escape spaces!) and user_name: your short user name.

Save the scpt to /Users/user_name/Library/Scripts/Folder Action Scripts/ with the name "alias - add alias instead of moving files.scpt".

Now create a folder "Inspirational" on your desktop and a folder "intermediate" somewhere else.

Right-click the folder "intermediate" and attach the above script to the folder:

enter image description here

Drag both folders to the dock. You may apply convincing icons to be able to tell which is which. If the folder action is activated, applying an icon to the "intermediate" folder will already create a file named _icon alias (or similar) in "Inspirational" folder. Please delete this file. In the example below the rose indicates the "Inspirational" folder and the chalkboard the "intermediate" folder

To create (an) alias(es) in the folder "Inspirational" drag one or several files and/or folders on the "intermediate" folder:

enter image description here

The aliases will be created in the folder "Inspirational" and the dragged files will be moved back to "Downloads":

enter image description here


You can't use only one folder, because this will invoke an endless loop: as soon as a new alias is created by adding a file to the folder action enabled folder, the new alias will be aliased itself too (because it's another "new" file). This would be repeated until your Mac dies!