3

I have a simple problem: Whenever I delete the templates folder in my home directory (/home/[username]/ in case that info is of use) it seems to come back. It contains nothing and I have no use for it. Is there a way to make it go away permanently?

7
  • What version of Ubuntu are you using? I've just deleted my Templates directory and restarted - it's not come back.
    – Carl H
    May 6, 2015 at 18:27
  • They can come back, depending on your configuration/desktop environment. They're called "XDG user directories". I have no time to delve into it now, but you can search starting from man xdg-user-dirs-update
    – Rmano
    May 6, 2015 at 18:32
  • 2
    Run ` sed -i.bak 's/^XDG_TEMPLATES_DIR/#&/' ~/.config/user-dirs.dirs` and then remove it.....now restart and check..
    – heemayl
    May 6, 2015 at 18:35
  • I'm on 12.04, why? May 7, 2015 at 17:39
  • Add a tag with your Ubuntu version
    – A.B.
    May 7, 2015 at 17:39

2 Answers 2

5

In your home folder is a configuration file ~/.config/user-dirs.dirs:

nano ~/.config/user-dirs.dirs

with a content like this:

[..]
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
[..]

You can comment out the line by which the folder will automatically create:

before:

XDG_TEMPLATES_DIR="$HOME/Templates"

after

#XDG_TEMPLATES_DIR="$HOME/Templates"

Or you can use a single command in a terminal:

sed -i.bak 's/^\(XDG_TEMPLATES_DIR=\)/#\1/' ~/.config/user-dirs.dirs

This can be undone:

sed -i.bak 's/^#\(XDG_TEMPLATES_DIR=\)/\1/' ~/.config/user-dirs.dirs

In both cases, a backup of your file will be created:

~/.config/user-dirs.dirs.bak
4
  • I went into the .config directory and there was no user-dirs.dirs May 7, 2015 at 17:39
  • @It'sWillem open terminal: file .config/user-dirs.dirs what output you get for this?
    – Alex Jones
    May 7, 2015 at 17:45
  • An empty text file named user-dirs.dirs May 7, 2015 at 18:16
  • It returned a "No such file" message May 8, 2015 at 0:36
2

As said by A.B., you must edit the configuration file:
nano ~/.config/user-dirs.dirs (use nano, vim or another text editor)

After that, remove the desired directories and edit the file:
sudo nano /etc/xdg/user-dirs.conf.

In this file, you must set enabled=False to avoid the system create these directories when logging in again.

(I found this information on https://superuser.com/questions/223918/ubuntu-permanently-remove-videos-and-public)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.