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?

A.B.
  • 92,125

2 Answers2

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
A.B.
  • 92,125
3

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)