Ubuntu 18.04 – How to Change Default Directories

directory-listinghome-directorymulti-bootUbuntu

I am dual booting Ubunto 18.04 and Windows 10 on a 2 disk set up that looks like this:

—-Hard Drive A—-

Ubuntu 18.04,
Windows OS

—-Hard Drive B—-

Storage (NTSF)

I have my OS's on one drive and then a second drive for storage of my files. I already changed the default directories on the windows side so that downloads, music, documents etc. save to Hard Drive B. Now I am just trying to accomplish the same thing on the ubuntu side. So I navigated to the .config file in the home directory and edited user-dirs.dirs to accommodate my design. This is the change I made:

XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_MUSIC_DIR="$HOME/User/Music"
XDG_DESKTOP_DIR="$HOME/User/Desktop"
XDG_DOWNLOAD_DIR="$HOME/User/Downloads"
XDG_DOCUMENTS_DIR="$HOME/User/Documents"
XDG_PICTURES_DIR="$HOME/User/Pictures"
XDG_VIDEOS_DIR="$HOME/User/Videos"

I changed to…

XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_MUSIC_DIR="/media/user/Shared/Music"
XDG_DESKTOP_DIR="/media/user/Shared/Desktop"
XDG_DOWNLOAD_DIR="media/user/Shared/Downloads"
XDG_DOCUMENTS_DIR="media/user/Shared/Documents"
XDG_PICTURES_DIR="media/user/Shared/Pictures"
XDG_VIDEOS_DIR="media/user/Shared/Videos"

where "user" is my username, "Shared" is the name of hard drive B, and (Music, Desktop, etc) are the names of the respective folders on that drive. I basically just navigated to each folder and coppied the location. My issue is whenever I restart my pc for it to take affect, it changes to this:

XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_MUSIC_DIR="$HOME/"
XDG_DESKTOP_DIR="$HOME/"
XDG_DOWNLOAD_DIR="$HOME/"
XDG_DOCUMENTS_DIR="$HOME/"
XDG_PICTURES_DIR="$HOME/"
XDG_VIDEOS_DIR="$HOME/"

instead of changing to the correct location, it defaults everything to home, so my desktop becomes the home directory. Where did I go wrong?

Best Answer

Why not simply make symbolic links?

First, make sure "storage drive" is in /etc/fstab and mounted at a consistent place each time (I put mine at /storage ...).

Then open a console-only VT session (be sure you are NOT logged into a desktop GUI session) and move your ~/Downloads, etc to /storage/youruser. You may need to fix permissions and/or ownership on the mount.

Once the files are on /storage, and your user can access them (read, write, create, delete) then use a link to get them back under your /home/username directory. To do this, go to your user's home directory (simply type cd and hit enter), and then make symlinks to each directory, for example

ivan@darkstar:~$ pwd
/home/ivan
ivan@darkstar:~$ ln -s /storage/ivan/Documents .

Note that trailing . on the end of the last command - it means "put it here in my current directory".

Related Question