10.6: Clear Finder's Recent Folders list at shut down

Feb 04, '10 07:30:00AM

Contributed by: ruggix

Snow Leopard only hintI use the following method to automatically clean, at shut down time, the entries in the Finder's Go » Recent Folders menu entry. It cost me some work, but eventually it worked. Open Terminal and do the following:

$ cd /etc/
$ sudo nano rc.shutdown.local
When prompted, enter your admin password. In the nano editor, add the following lines (assuming the file doesn't yet exist):
#!/bin/bash

cd /Users/your_user/Library/Preferences/
defaults delete /Users/your_user/Library/Preferences/com.apple.finder FXRecentFolders
chown your_user:your_group com.apple.finder.plist
And now some explanation. your_user is obviously the short name of the user whose Finder preference file you want to edit. your_group is the group your user belongs to -- this is usually staff.

The chown command is needed because these commands are executed by the script as root. So the defaults delete command changes the ownership of the com.apple.finder.plist file, resulting in the loss of your Finder's preferences at reboot. For the same reason, the commands specify the full path to files, because the script isn't running as your user.

The rc.shutdown.local file does not need to be set as executable. It works like it is, but please remember to reboot twice after any change in order to see the effects.

[robg adds: I haven't tested this one. To confirm your user's group membership, you can use groups (which has technically been replaced by the less-obvious id -Gn, but still works in 10.6).]

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=2010020209234887