红联Linux门户
Linux帮助

xdg-user-dirs:控制$HOME目录下面Music, Videos等目录存在与否

发布时间:2007-12-12 01:38:12来源:红联作者:scriptaj
[root@localhost ~]# pwd
/root
[root@localhost ~]# cd .config/
[root@localhost .config]# ll
total 28
drwxr-xr-x 2 root root 4096 2007-11-26 17:17 audacious
drwxr-xr-x 4 root root 4096 2007-11-28 11:34 banshee
drwxr-xr-x 3 root root 4096 2007-11-28 10:52 bmpx
drwx------ 2 root root 4096 2007-12-10 15:53 gtk-2.0
drwxr-xr-x 2 root root 4096 2007-11-29 11:07 menus
-rw------- 1 root root 617 2007-12-10 16:48 user-dirs.dirs
-rw-r--r-- 1 root root 5 2007-11-22 10:52 user-dirs.locale
[root@localhost .config]# cd /etc/xdg
[root@localhost xdg]# ll
total 40
drwxr-xr-x 2 root root 4096 2007-11-29 12:07 autostart
drwxr-xr-x 6 root root 4096 2007-12-07 15:01 menus
drwxr-xr-x 2 root root 4096 2007-11-29 12:06 Thunar
-rw-r--r-- 1 root root 414 2007-08-21 20:12 user-dirs.conf
-rw-r--r-- 1 root root 421 2007-12-10 16:35 user-dirs.defaults
drwxr-xr-x 4 root root 4096 2007-11-29 12:07 xfce4
drwxr-xr-x 2 root root 4096 2007-11-29 12:07 xfce4-session

[root@localhost xdg]# xdg-user-dir
xdg-user-dir xdg-user-dirs-gtk-update xdg-user-dirs-update

[root@localhost xdg]# which xdg-user-dirs-update
/usr/bin/xdg-user-dirs-update
[root@localhost xdg]# rpm -qf /usr/bin/xdg-user-dirs-update
xdg-user-dirs-0.9-1.fc8

把.config/user-dirs.conf文件中有关Pictures的那行注释掉,运行xdg-user-dirs-update有如下信息:

[root@localhost ~]# xdg-user-dirs-update
/root/Pictures was removed, reassigning PICTURES to homedir

就是说那些目录不能直接删除,那样的话下次启动还会自动生成。可以通过修改上述配置文件,它在update时会把路径设置为$HOME,也就相当于删除了相应目录:

$(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.
文章评论

共有 0 条评论