Article View: news.software.nntp
Article #11245Re: Automatically Stripping Binaries
From: Dennis Cox
Date: Mon, 30 Sep 1996 00:00
Date: Mon, 30 Sep 1996 00:00
63 lines
1981 bytes
1981 bytes
Used to happen to me every once in a while, so I used to run a cron job
that finds a files the file size in certain groups and deletes it if it matches
it. The script basically is this...
[This is not a working script - just a basis - please no flames - if it doesn't
work]
-----------CFG FILE BELOW---------[filename: rm.News.dir.list]-------
/news/alt/binaries/pictures/hamster/sex/with/goats/in/broad/daylight
/news/alt/binaries/sounds/moaning/of/a/sheep/for/you/scotts
etc.etc.etc.
-----------PERL SCRIPT BELOW---------[filename: rm.News]
#!/usr/bin/perl
$SIZE = 500000;
open(LIST,"rm.News.dir.list");
while($DIR = <LIST>)
{
chop($DIR);
system("ls -l $DIR > /tmp/tmp.dirlist");
&KillIT;
}
close(LIST);
sub KillIT
{
open(DIR,"/tmp/tmp.dirlist");
while($line = <DIR>)
{
chop($line);
# My system is a Sparc 20 running Solaris 2.5 - so your milage will
# vary on the output of ls
($rwx,$num,$own,$grp,$size,$month,$day,$time,$filename) = split(" ",$line);
if($rwx eq "-rw-rw-r--")
{
if ($size > $SIZE)
{
print "Deleting $DIR/$filename - $size\n";
system("rm $DIR/$filename");
}
}
}
close(DIR);
}
That's it... I think this should work - have fun!
--------,,,^0.0^,,,---------
Dennis Cox - SysAdmin
Internet Global Services, Inc
dennis@develop.iglobal.net
http://develop.iglobal.net
Technical Details
Message-ID:
<m2ohinz3xa.fsf@develop.iglobal.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<bob.alberti-3009961018200001@news.network.com>Show Full Headers
Complete Article Headers
Message-ID: <m2ohinz3xa.fsf@develop.iglobal.net> Subject: Re: Automatically Stripping Binaries Date: Mon, 30 Sep 1996 00:00:00 +0000 From: Dennis Cox <dennis@develop.iglobal.net> References: <bob.alberti-3009961018200001@news.network.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 186388035 Organization: Internet Global Services, Inc. Newsgroups: news.software.nntp