Remove menu clutter after installing multiple distros

Q After installing various distros I have a cluttered /home/username folder and a menu full of unusable program entries. How can I delete these dead entries and sort the files into folders by extension, for example putting all GIF, PNG and JPEG files into one directory? I would also need to deal with duplicate files. This is in preparation for reinstalling Ubuntu.

A I would rename the /home/username folder before installation, then only copy over the files you need. This is probably easier than trying to clean out the detritus from a live home directory. The best program I have found for identifying and removing redundant files is Kleansweep, from http://linux.bydg.org/~yogin. Finding duplicate files is best done with Fdupes from http://netdial.caribe.net/~adrian2/fdupes.html. Use it like this:

fdupes --recurse ~
fdupes --recurse --omitfirst ~ | xargs rm

The first line will show all duplicate files, the second will remove all but the first occurrence of each file - use this with care. Sorting files by name is best done with the find command. You can move the files you mention with

mkdir pics
find ~ -iname '*.jpg' -o -iname '*.png' -o -iname
'*.gif' -exec mv "{}" pics ';'

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar