Aliases in OS X are identified to the system by an attribute referred to as the alias bit. This hint provides a very simple way to be able to toggle the alias bit of selected files within the Finder.
There may be some need to be able to toggle the alias bit of files from within the Finder. For example, I found that using Bittorrent Sync to keep files synchronized across multiple devices is very useful and a real time saver, but suffers from a bug in the OS X version, that causes aliases to lose their status as aliases. I traced the problem to the alias bit not syncing and though the developers continue to promise to fix it, I got tired of waiting.
So I put together an Automator action that installs as a service in OS X. It adds a Service to the contextual menu that will toggle the alias bit on any file or folder in the Finder. It works on multiple files at once. Just select what you want, right click, and choose 'Toggle Alias Bit.' I made it a toggler rather than a setter so you can undo it if you accidentally turn a regular file into an alias.
I'm hosting it via my Google Drive if you want to download it.
To install, unzip it, double click it, done (sort of). If you don't have Xcode installed, the first time you try to use it there will be a short pause, then you'll be prompted to download and install Xcode developer tools. This will happen automatically, you just need to OK it. The reason for the developer tools requirement is the use of the GetFileInfo and SetFile commands, which are part of that.
If you want to do it yourself in Automator, here are the relevant steps:
[crarko adds: I haven't fully tested this one. I had some problems working with the downloadable version, so I'd recommend creating the Service from scratch using the code above. I already have Xcode installed so I did not get the prompt to install it, as expected.]
There may be some need to be able to toggle the alias bit of files from within the Finder. For example, I found that using Bittorrent Sync to keep files synchronized across multiple devices is very useful and a real time saver, but suffers from a bug in the OS X version, that causes aliases to lose their status as aliases. I traced the problem to the alias bit not syncing and though the developers continue to promise to fix it, I got tired of waiting.
So I put together an Automator action that installs as a service in OS X. It adds a Service to the contextual menu that will toggle the alias bit on any file or folder in the Finder. It works on multiple files at once. Just select what you want, right click, and choose 'Toggle Alias Bit.' I made it a toggler rather than a setter so you can undo it if you accidentally turn a regular file into an alias.
I'm hosting it via my Google Drive if you want to download it.
To install, unzip it, double click it, done (sort of). If you don't have Xcode installed, the first time you try to use it there will be a short pause, then you'll be prompted to download and install Xcode developer tools. This will happen automatically, you just need to OK it. The reason for the developer tools requirement is the use of the GetFileInfo and SetFile commands, which are part of that.
If you want to do it yourself in Automator, here are the relevant steps:
- Open Automator and choose Service as the type of new document.
- Drag Run Shell Script to the workflow. Make sure the Service receives selected files or folder in Finder, are checked for the options. Shell should be
/bin/bash
and pass input as arguments - Copy and paste the following into the 'Run Shell script' box:
#This script will toggle the alias bit for a file for f in "$@" do #GetFileInfo -aa should return 1 for alias, 0 for not alias if [ `GetFileInfo -aa "$@"` == "1" ] # if it's an alias then SetFile -a "a" "$@" # set it to not be an alias else SetFile -a "A" "$@" # otherwise, it's not an alias, so make it one fi done
- Save it as something useful like 'Toggle Alias bit.'
- Use as described above.
[crarko adds: I haven't fully tested this one. I had some problems working with the downloadable version, so I'd recommend creating the Service from scratch using the code above. I already have Xcode installed so I did not get the prompt to install it, as expected.]
•
[9,651 views]