Wednesday, November 24, 2010

Move folders that are expected in specific locations - Mac OS X Hints

Move folders that are expected in specific locations - Mac OS X Hints


Move folders that are expected in specific locations
Oct 29, '10 07:30:00AM • Contributed by: michelcolman
Quite a few badly written apps like to create folders in specific locations, and expect them to be there and nowhere else. For example, my ~/Documents folder contains items such as 'Microsoft User Data', 'Steam Content', 'TomTom', etc. Some even create folders in your home directory or worse, at the root level of the hard disk!

Sometimes you can set a different location in the preferences of the application, but sometimes there's just no way. If you move the folder, the application will become hopelessly confused and/or create a new copy where it expects it. You can make these folders invisible, but then you can't easily access them anymore.

To move the folder wherever you want to move it to (for example, into a separate 'User Data' folder), create a symbolic link where the app expects it, and then hide the link.

Unfortunately 'chflags hidden' does not work on symbolic links for some reason, so you have to use SetFile which is installed as part of Developer Tools or can be found in various other locations. Just try it, and if it doesn't work, do an advanced search on MacOSXHints for articles with 'SetFile' in the title. (You might also be able to use the '.hidden' file although that is considered to be deprecated).

So anyway, once you have SetFile, do the following:
In the Finder, drag the offending folder to its new location
Open Terminal, and type ln -s with the trailing space but without pressing Enter or Return
Drag the folder from the new location into the Terminal window.
Drag the old location (the folder where the offending folder used to be located, for example Documents) to the terminal window. The command in Terminal should now look something like ln -s /Users/me/User Data/TomTom /Users/me/Documents.
Make sure the Terminal window is frontmost, and press return to execute the command. You will see the link appearing at the old location in the Finder. It looks just like an alias.
In the terminal, type SetFile -P -a V (with the trailing space) and drag the link (the one with the little arrow that looks like an alias) from the Finder to the Terminal window.
Press enter.
The link is now invisible. To the application, it seems as though the folder is still there in its old location.

No comments:

Post a Comment