Move 'Pictures', 'Documents', 'Movies' etc folders
I would like to move folders like 'Pictures', 'Documents', 'Movies' to a different from the default under the root of user's home location, preferably into a sub-folder under the same user's home folder. For example, user/Music would go to user/stuff/Music.
I'd rather not create symbolic links to moved folders, but change system's behaviour altogether, so it knows where to find those folders.
Please bear in mind that I do not want to move user's home folder, but just those ones, for example, move them to /Users/[user name]/stuff/ since I don't like them polluting the home folder there.
Art,
Do you have this working successfully?
Have you tried hiding the folders using something like:
chflags hidden ~/Documents
Then creating a link to it such as (in Terminal):
cd ~
mkdir stuff
cd stuff
ln -s ~/Documents
I believe that this will hide the ~/Documents folder from the Finder but it will still be there so anything writing to it will work OK. In addition you will see the link in ~/stuff...
I personally use symlinks to move all of those directories under my User account. I logged in as root and symlinked all of my directories "Documents' Downloads " Movies", etc and moved them to an external drive.
Mac OS sees the changes just fine and points to those directories (on the external drive) automatically and I have had no issues doing it this way.
There is a System Service called SymbolicLinker
that will add an option to your context menu that will create a symbolic link for you.
How to enable the root user
OS X Lion
- From the Apple menu choose System Preferences....
- From the View menu choose Users & Groups.
- Click the lock and authenticate as an administrator account.
- Click Login Options....
- Click the "Edit..." or "Join..." button at the bottom right.
- Click the "Open Directory Utility..." button.
- Click the lock in the Directory Utility window.
- Enter an administrator account name and password, then click OK.
- Choose Enable Root User from the Edit menu.
- Enter the root password you wish to use in both the Password and Verify fields, then click OK.
Mac OS X v10.6.x
- From the Apple menu choose System Preferences....
- From the View menu choose Accounts.
- Click on the lock and authenticate with an administrator account.
- Click Login Options....
- Click the "Edit..." or "Join..." button at the bottom right.
- Click the "Open Directory Utility..." button.
- Click the lock in the Directory Utility window.
- Enter an administrator account name and password, then click OK.
- Choose Enable Root User from the Edit menu.
- Enter the root password you wish to use in both the Password and Verify fields, then click OK.
You can move your entire user account (home) folder using the following steps:
- Click on Users & Groups in System Preferences.
- Unlock the pane (lock icon).
- Right click on your selected user and choose the "advanced" option from the list.
- You will be greeted by the following screen:
From there, simply select the "home directory" to which you wish to relocate the profile to, then reboot.
Note: This will move all the contents found under /Users/{your user}/
(Downloads, Documents, Music, etc.)
Well, the short answer is: Don't, because too many things depend on it. This is also the reason why Apple choose to make it difficult to rename these folders.
If you want to take the risk anyway, this answer to a somewhat related question should give you some ideas.
You can try to add the following Bash code to your ~/.bash_profile. It changes the ls
command when run in $HOME
to not show certain folders ("Music", "Movies", "Pictures", etc.).
All this does is change what ls
displays in the $HOME
directory. It doesn't actually delete the folders. For example, if you do ls -l
you will see that the folders are still there.
function ls-home() {
excludeDirectories=(
"Music"
"Movies"
"Pictures"
"Public"
"Documents"
"Desktop"
"Downloads"
"VirtualBox VMs"
)
files=$(comm -23 <( /bin/ls -1) <(printf '%s\n' "${excludeDirectories[@]}" | sort))
temporary_dir=$(mktemp -d)
for file in $files; do
if [ -h $file ]; then
ln -s $file $temporary_dir/$file
elif [ -f $file ]; then
touch $temporary_dir/$file
if [ -x $file ]; then
chmod +x $temporary_dir/$file
fi
else
mkdir $temporary_dir/$file
fi
done
/bin/ls $temporary_dir
rm -rf $temporary_dir
}
function ls-shim() {
if [ "$(pwd)" = "$HOME" ]; then
lastArgument="${@:-1}"
if [ "${lastArgument:0}" = 1 ]; then
ls-home
else
/bin/ls "$@"
fi
else
/bin/ls "$@"
fi
}
alias ls="ls-shim"
Screenshots of script in action: