Friday, July 7, 2017

Redirect HOME folders on a Mac

I have always liked to separate my data from the system files on my Mac. That way I can use TimeMachine to restore an earlier version of my system drive without worrying about reverting my documents and vice-versa. Call it personal style, but this is how you do it:

I will take you through processing the DOCUMENTS folder, then you can rinse and repeat for MUSIC, PICTURES or whatever you want.

* DON'T BE A MORON, BACKUP YOUR DATA FIRST *

  • Create your target folder on your separated data drive. In my case a folder called 'Documents'
  • Now we need to maintain the icon the easy way before we lose it by deleting the original folder. So, open a Get-Info window for both the original and the new folders. At the tippy-top of the Get-Info window is a miniature version of the icon. We are going to copy and paste it from the original to the new. Its a little weird because don't bother right-clicking for a context menu, there isn't one. This is what you do - click the miniature version of the original and the icon will have a glow around it. CTRL-C. Go to the miniature icon in the Get-Info for the new folder, click it until it glows. CTRL-V.
  • The next step is to replace the existing 'Documents' folder with a junction link. Since it will replace the existing 'Documents' folder we need to delete it. (Repeat) we will be deleting the documents folder, so BACK IT UP!
  • Launch a terminal window and enter
chmod -R -N ~/Documents

  • That will change the permission on that folder to allow you to delete it, now we will delete it.
rm -rf ~/Documents
  • You should see your regular Documents folder vanish. It may come back after a few seconds as some Apple watchdog process corrects what it thinks is an error condition. Don't worry just run it again and move on to the next command as quickly as you can, and that is to create the junction link that replaces the regular folder and points to your new folder:
ln -s /Volumes/Data/Documents
  • Replace the word 'Data' with the name of the drive that contains your new Documents folder.
  • Job done, you should now have a redirect in place. You can prove that by manually placing a file in the new folder, then navigate to your Documents folder using the 'GO' menu on the taskbar.
Cheers!




No comments:

Post a Comment