27

I've deleted the folders, but every time I sign back in they're recreated. I've edited ~/.config/user-dirs.dirs and removed the offending lines, but they're replaced when I log back in! The file say's it's auto-generated by /usr/bin/xdg-user-dirs-update, but that seems to be a dead end.

1
  • I deleted the user but that particular user's name is coming at the ubuntu 10.04 lts login prompt and not getting deleted from there. please let me know how to achieve this. thx.
    – user101200
    Oct 12, 2011 at 18:02

6 Answers 6

33

Three files control the "personal special folders" behaviour:

  • ~/.config/user-dirs.dirs - allow the user to specify a custom path for the special folders. So you can have you Music folder in, say, "$HOME/My Music", or "/datapartition/mp3". Its does not allow you to "disable" those folders. If you delete one line (or the whole file), default values will be used, as you have already noticed.

  • /etc/xdg/user-dirs.conf (overrided by ~/.config/user-dirs.conf) - Allows you to enable or disable the automatic folder (re-)creation. If you set enabled=False, either globally or for your own user only, special folders will not be re-created at login anymore in case you delete or rename the folders.

  • /etc/xdg/user-dirs.defaults- Global template for folders path and name. This is the file read when ~/.config/user-dirs.dirs is re-created. Be aware that changing default names will prevent folder names to be localized (translated) if you change your Language/Locale.

By the way, the service you disabled was just the daemon that would offer to rename the folders in case you changed your Language/Locale.

22

Your problem has been explained at the software wiki

Settings

Sysadmins can configure things by editing /etc/xdg/user-dirs.conf. At the moment there are only two settings, you can disable the whole thing, and you can specify the charset encoding used for filenames. They can also set or change the default directories and their initial values in /etc/xdg/user-dirs.defaults.

$(XDG_CONFIG_HOME)/user-dirs.dirs specifies the current set of directories for the user. This file is in a shell format, so its easy to access from a shell script. This file can also be modified by users (manually or via applications) to change the directories used. Note: To disable a directory, point it to the homedir. If you delete it it will be recreated on the next login.

So your ~/.config/user-dirs.dirs could be modified as

XDG_DOWNLOAD_DIR="$HOME"
XDG_TEMPLATES_DIR="$HOME"
XDG_PUBLICSHARE_DIR="$HOME"
XDG_DOCUMENTS_DIR="$HOME"
XDG_MUSIC_DIR="$HOME"
XDG_PICTURES_DIR="$HOME"
XDG_VIDEOS_DIR="$HOME"
7

On at least Ubuntu 18.10, you can just remove the directories and run the following command in a terminal:

xdg-user-dirs-update 

The entries will be reassigned to home and disappear from the list under Files.

1
  • 1
    Works on Ubuntu Focal Fossa (development branch) i.e. 20.04 dev Jan 28, 2020 at 12:19
2

It is actually a daemon that creates those folders, check the startup preferences, its on the system menu i believe, you can easily disable that feature.

1
  • the only thing i can find that looks like it could be it is xdg-user-dirs-gtk-update - Update common folders names to match current locale, which is disabled
    – nona
    Dec 20, 2010 at 5:18
1
sudo apt-get --purge remove xdg-user-dirs*
1
  • 1
    How is this better than other answers?
    – Toto
    Feb 24, 2018 at 14:54
0

You can try install Ubuntu Tweak... under "Personal"+"Default Folder Locations" tab: you can change the location of the folders to wherever you wish or you can just have them all pointing to the same directory (i.e. /home/user/)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .