I'm an avid Linux user. What to most Windows users is their Desktop, is my home directory to me. When ever there is a download to save, a file to create or an archive to unpack – it will be done in my home directory.
This quickly turned into a mess in the past. My first attempt to solve the problem was to use a subdirectory called temp. Of course this didn't solve anything, it just moved the problem to a different directory.
The system that finally worked for me is using daily temp directories. To make this easy to manage I use a simple command defined in my ~/.bashrc. Let's have a look at the code first:
export TD="$HOME/temp/`date +'%Y-%m-%d'`" td(){ td=$TD if [ ! -z "$1" ]; then td="$HOME/temp/`date -d "$1 days" +'%Y-%m-%d'`"; fi mkdir -p $td; cd $td unset td }
The command is called td. When called it checks if today's temp dir already exists or creates it if necessary. It then changes into the directory.
The command also accepts an argument to access previous temp directories. Just add a minus and the number of days you want to go back.
Quick example? It works like this:
~$ date Wed Feb 27 20:24:37 CET 2008 ~$ td ~/temp/2008-02-27$ td -2 ~/temp/2008-02-25$
Additionally to the td command a variable called $TD is defined. It just points to today's directory. This is quite handy if you need to copy something from or to your temp directory.
My new system helps me to have a clean workspace for trying stuff everyday. All I have to do is to delete old temp dirs from time to time when disk space becomes scarce.
What's your way to keep your $HOME clean and your mind sane?
I do something very similar! I have my entire home directory in mercurial version control, and if I don't run hg add on something, then it's clearly not important enough to save or a program generated it for me.
So I run a script that takes all files that haven't been added, and moves them to ~/zip (don't ask why it's named zip, I don't know either). The neat part is it also keeps the directory hierarchy. So if I put a file in ~/doc/resume/beta.tex but forget to hg add it, it gets moved to ~/zip/doc/resume/beta.tex.
Now I forget to clean out ~/zip a lot... but if I don't LOOK at ~/zip for months at a time, clearly the data is not important, and I just run rm -rf ~/zip.
It's neat we both took the same versioned approach to our files, in very different fashions ;)