skip to main bit
a man slumped on his desk, from 'The Sleep of Reason Produces



Archive for August 29th, 2008


the most useful simple script i have

Lee’s comment that mentions having a folder for items you’re about to delete reminds me of probably the script that has most contributed to sanity in my filing system. It’s pig simple, albeit a bit scary to write and enact. All it does is delete everything in a given folder that’s over a week old.

I’ve had bad experience with handing “delete file” powers to an automatic script before, so I’ll disclaim any warranty (“TO THE EXTENT PERMITTED BY APPLICABLE LAW” as the GPL shouts), but it’s pretty straightforward, and works for me: I have it in a cronjob. The tmp folder it cleans up is my default save folder on Firefox, and where I generally download everything. If I want to save anything longer than a week, I find it a place in the rest of my filing system. It’s sort of like having a cleaner come around every week: occasionally you go “Garr! Where’s that coffee-stained, have torn copy of last month’s New Yorker! I was going to eventually get around to reading that!”, but mostly your cruft just silently disappears without you noticing a thing.

You’ll need to replace /home/danny/tmp with your own dumping ground. If you run it like this:

It’ll tell you what it’s planning to delete. Run it without the -d and it really will delete those things, blam.


petit disclaimer:
My employer has enough opinions of its own, without having to have mine too.