Redirecting Folders on Apple OSX

How do you redirect folders in Apple OSX? It’s pretty easy.


====
One thing that can be quite useful on OSX is the ability to redirect folders from a standard location to another using symbolic links.

For example, on my laptop I have two hard disks - an SSD for my operating system and applications, and a second traditional physical drive for data storage. With an SSD you really want to reduce the number of writes due to the write fatigue that SSDs can experience.

The way to do this is to redirect common folders to another location or drive. In my system for example I redirect my ‘Documents’ folder and my ‘Downloads’ to my second hard disk. Same for Movies & Music.

It’s a pretty straight-forward process to do - let’s run through how to redirect ‘Documents’ from its normal location to my data volume.

Original Source
/Volumes/OSX/Users/MarkC/Documents

Preferred Target
/Volumes/DataVol/Documents

The first thing you need to do is copy everything from the existing folder to the new location. That’s pretty easy - you can do that with Finder.

Next, you need to modify the permissions on the folder you’re relocating. You do this from Terminal. Start Terminal (from Spotlight or from the Applications/utilities folder) and use this command:

chmod -R -N ~/Documents

The ‘~’ in the command above refers to the home directory - it’s a shortcut.

Now we’ve changed the permissions, we need to delete the original folder. To do this, enter the following command:

rm -rf ~/Documents

Just to be clear - ensure you have a copy of your data before you run the above!

Next, we create a symbolic link for the original folder to the new target. This can be done with the following command:

ln -s /Volumes/DataVol/Documents ~/Documents

Note that in the above replace the ‘DataVol’ with your target volume.

That’s all there is to it.

Modify the above paths to match the folders you’re trying to redirect.


blog comments powered by Disqus