🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: uk.comp.os.linux
Article #711

Re: Yet another crash!

#711
From: Dave Thorn
Date: Mon, 28 Feb 2000 00:00
39 lines
2153 bytes
On Tue, 22 Feb 2000 23:29:14 +0000, Colin Smith <colin@Yelm.freeserve.co.uk> 
wrote in message <slrn8b66u7.6us.colin@Orlanth.homenetwork>:
>
>Here's the shell code for 'del'.
>------------------
[snip code]
>------------------


that's nice.  and to join it, here's a script to delete those entries
after they've been sitting there for some time.  add it to your
crontab.  No, it's not a one-liner, sorry.  Doubtless this could be
written better (I'd cross-post to comp.lang.perl.misc if I really
wanted it taken apart :).  Usual disclaimers, no warranty, GPL'd, etc,
etc.


#!/usr/bin/perl -w
use strict;

my $TRASH_DIR = $ENV{HOME}.'/.trash';
my $EXPIRY = shift || 7;

opendir(DIR, $TRASH_DIR) 
  or die "can't opendir '$TRASH_DIR': $!";

my @files = grep {
    (-M "$TRASH_DIR/$_" > $EXPIRY) && (-f "$TRASH_DIR/$_")
} readdir(DIR);

foreach my $file (@files) {
    unlink "$TRASH_DIR/$file" or warn "Cannot unlink '$file': $!";
}

__END__


-- 
#include <disclaimer.h>
Technical Details
Message-ID: <slrn8bkg1g.et.davet@molochai.tw2.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <RJYW3.61$ju1.1566@nnrp4.clara.net> <FL3x5A.E5B@dangl.demon.co.uk> <383728e4@news.jakinternet.co.uk> <81rsh3$khi$1@fantasma.gsyc.inf.uc3m.es> <826a4r$mr5$1@sparky.wolfe.net> <385B6A68.838DAC06@r56o.f9.co.uk> <86fu3t$f29$1@news8.svr.pol.co.uk> <86g5dk$c5f$1@nnrp1.deja.com> <86io9q$nsv$1@newsg1.svr.pol.co.uk> <388E03F2.EA9A9682@netscape.net> <86lb70$meo$3@news5.svr.pol.co.uk> <388f2e8f.65436@news.greatxscape.net> <86nvkc$f11$1@news8.svr.pol.co.uk> <389091bc.2929952@news.greatxscape.net> <slrn899 <slrn8b3clu.7lu.phuae@primrose.csv.warwick.ac.uk> <slrn8b66u7.6us.colin@Orlanth.homenetwork>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111053,9e82041a3ad6a90
X-Google-Attributes: gid111053,public
X-Google-Thread: 10d8ad,b33046ac4fb17395
X-Google-Attributes: gid10d8ad,public
From: davet@tw2.com (Dave Thorn)
Subject: Re: Yet another crash!
Date: 2000/02/28
Message-ID: <slrn8bkg1g.et.davet@molochai.tw2.com>
X-Deja-AN: 590775579
References: <RJYW3.61$ju1.1566@nnrp4.clara.net> <FL3x5A.E5B@dangl.demon.co.uk> <383728e4@news.jakinternet.co.uk> <81rsh3$khi$1@fantasma.gsyc.inf.uc3m.es> <826a4r$mr5$1@sparky.wolfe.net> <385B6A68.838DAC06@r56o.f9.co.uk> <86fu3t$f29$1@news8.svr.pol.co.uk> <86g5dk$c5f$1@nnrp1.deja.com> <86io9q$nsv$1@newsg1.svr.pol.co.uk> <388E03F2.EA9A9682@netscape.net> <86lb70$meo$3@news5.svr.pol.co.uk> <388f2e8f.65436@news.greatxscape.net> <86nvkc$f11$1@news8.svr.pol.co.uk> <389091bc.2929952@news.greatxscape.net> <slrn899 <slrn8b3clu.7lu.phuae@primrose.csv.warwick.ac.uk> <slrn8b66u7.6us.colin@Orlanth.homenetwork>
X-Trace: fu-berlin.de 951730241 2359461 62.232.8.252 (16 [9456])
User-Agent: slrn/0.9.6.2 (Linux)
Reply-To: davet@tw2.com
Newsgroups: uk.comp.os.linux,freeserve.help.unix