Features Podcasts Family Video Comics Music Tech Science Books Film & TV Games ✚

Jill

Simple way to keep your download folder tidy

Cory Doctorow at 2:35 am Sat, Aug 30, 2008

— FEATURED —

THE LATEST

Guatemala: Nation's highest court throws out Ríos Montt genocide trial verdict and prison sentence

Feature

Eurovision 2013: An American in London

Book Review

The Twelve-Fingered Boy - mesmerizing YA horror novel

Book Review

Black Code: how spies, cops and crims are making cyberspace unfit for human habitation

— FOLLOW US —

Boing Boing is on Twitter and Facebook. Subscribe to our RSS feed or daily email.

 

— POLICIES —

Except where indicated, Boing Boing is licensed under a Creative Commons License permitting non-commercial sharing with attribution

 

— FONTS —

Tweet
Kindle
From Danny O'Brien, a nice hack for keeping your download folder tidy -- a script that deletes everything that's more than a week old. I'd like one of these to run on my ~/.Trash folder, too.
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.
the most useful simple script i have

I write books. My latest is a YA science fiction novel called Homeland (it's the sequel to Little Brother). More books: Rapture of the Nerds (a novel, with Charlie Stross); With a Little Help (short stories); and The Great Big Beautiful Tomorrow (novella and nonfic). I speak all over the place and I tweet and tumble, too.

More at Boing Boing

Eurovision 2013: An American in London

The technology that links taxonomy and Star Trek

  • Danny O’Brien

    #2 — your script was similar to my script, until it hit files with spaces in their name

    tmpwatch and tmpreaper are both perfect for this job, too.

  • acx99

    try tmpreaper

  • n

    What’s wrong with ‘rm `find . -mtime +7`’?

  • Andrew W

    Mac users can use rmtrash, available from Mac Ports. Instead of deleting of files, it moves them to the trash folder.

    Danny’s script seems a bit like overkill, though.

    a.

  • hijukal

    I keep my Desktop free of icons. Everything I download goes onto my Desktop. When you can’t find anything because the thing looks so cluttered you tend to organise (i.e. move for permanent storage or delete) it pretty quick.

  • Matthew Miller

    #2 — because you probably want atime, not mtime. Or at least I do. Except for directories, where atime is useless. Since tmpwatch comes with all Red Hat-family distros (and probably most other Linux flavors as well), I typically do this in my crontab:

    /usr/sbin/tmpwatch –dirmtime 240 ~/tmp

  • Neko

    I’ve been playing with AWN’s “Stacks” applet, which combined with the ‘folder’ backend, sorted by date and set to the “Trasher gui” layout, -might- just replace my current system of, yes, dump everything on ~/Desktop and tidy up when it reaches to my second monitor.

    I’d love a way to automatically identify, collate, and file images which are also cat macros though. I wonder if I could OCR them… *wanders off absentmindedly*

  • snej

    I use the Mac program Hazel for this:
    http://www.noodlesoft.com/hazel.php
    It lets you set up arbitrary rules for processing items in folders, either at the point they get added or at any later time. Very useful for a variety of things, and very intuitive to use.

    (Yes, I know shell scripting, but I don’t want to have to put on my programmer’s hat and waste ten minutes getting stupid quotes in the right places, when all I wanted to do was clean up my downloads.)

  • boing_x

    why can’t you just sort by date and delete everything more than a certain period old?

  • LogicalDash

    The function this describes seems much too simple for a script. Just save

    @weekly rm -r {your temp folder}

    to a text file, then run

    crontab {the filename}

    in a terminal. You’re done. You don’t get any confirmation stage, but if you want to see what the job would delete, you could also just open the temp folder in your file manager.

  • LogicalDash

    …Except that this will actually delete *everything* in the folder, not just unmodified-in-a-week stuff. Sorry, I misunderstood what the script claimed to do.

  • proto

    Huh? Just buy a bigger disk. By the time your drive is full, it’s time to upgrade. The old one’s probably worn out anyway.