Quoting Adam Wendt <[EMAIL PROTECTED]>:
> I've got two related but separate things I need to do.
> 1) Recursivly assend into a directory and remove files that are under a
> certain
> size (lets just say 5k)
> 2) Recursivly assend into a directory and move all the files of a certain
> pattern (*.html) to one directory
Well, this may help you a BIT on the perl side. This is a function I wrote
as part of a program to scan for certain files, recusively through subdirs..
This function will accept a directory, aka, /tmp, and fill @fileArray with a
list of all of the files under that dir. A test script for something like you
where talking about would be:
my @FileArray;
&ReadDir("/tmp");
foreach $file (@FileArray)
{
if($file ~= /html$/)
{
system("mv $file /destdir");
}
}
This is really quick, qand I didn't test it, but hopefully it'll give you a
rough idea. Again, the function was a quickie, so yes, it could be prettied
up, but it works for a 2 minute hack..
sub ReadDir
{
local $CurDir = $_[0] . "/";
local @INDIRAR, $INFILEVAL;
opendir(INDIRFIL, $CurDir) or die "Couldn't recurse to $CurDir";
@INDIRAR = readdir(INDIRFIL);
foreach $INFILEVAL (@INDIRAR)
{
if($INFILEVAL eq(".") || $INFILEVAL eq(".."))
{
next;
}
if( -f $CurDir . $INFILEVAL)
{
@FileArray[$#FileArray + 1] = $CurDir . $INFILEVAL;
}
else
{
if( -d $CurDir . $INFILEVAL)
{
&ReadDir($CurDir . $INFILEVAL);
}
}
}
}
**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************