:: whot@yabbi:~> cat scripts/tmp-today #!/bin/bash date=`date +%Y-%m-%d-%a` tmpdir=$HOME/tmp/$date tmplink=$HOME/tmp/today if [ -e "$tmpdir" ]; then exit 0 fi mkdir $tmpdir ln -sf $tmpdir $tmplinkAnd the crontab entries to run this script:
0 2 * * * /home/whot/scripts/tmp-today @reboot /home/whot/scripts/tmp-todaySo run the thing at 2.00 am and on every reboot in case the box was shut off overnight. I had it on midnight first, but I think 2 am is better. If I'm still up at 2 and working, then mentally I'm still in on the day before and I don't want files to end up in different directories just because midnight clocked over. And because the laptop may be suspended overnight, we run the script on resume as well:
:: whot@yabbi:~> cat /etc/pm/sleep.d/00-tmp-dir #!/bin/bash case "$1" in thaw|resume) su -c - whot /home/whot/scripts/tmp-today ;; *) ;; esacThis obviously works for other directories as well, e.g. your daily download directory.