S
SteveO
I am a Perl beginner and I hve writen this script to remove files older
than 30 days, it works well EXCEPT that it leave the empty directories
behind, can anyone help me look for empty directories and remove them
as well?
TIA,
Steve
#! Perl -w
use Strict;
use File::Find;
$tempdir = "D:\\shared dirs\\temp Public";
find(\&Wanted, $tempdir);
sub Wanted
{
#Do not scan Purchasing or Budget
return $File::Find:
rune = 1 if $_ eq "Purchasing - Do Not Remove";
return $File::Find:
rune = 1 if $_ eq "BUDGET";
# only on files older than 30 days
if ( ( -M $_ ) > 30 ) {
@args = ("del", "/F", "/Q", "$_");
system @args;
}
}
than 30 days, it works well EXCEPT that it leave the empty directories
behind, can anyone help me look for empty directories and remove them
as well?
TIA,
Steve
#! Perl -w
use Strict;
use File::Find;
$tempdir = "D:\\shared dirs\\temp Public";
find(\&Wanted, $tempdir);
sub Wanted
{
#Do not scan Purchasing or Budget
return $File::Find:
return $File::Find:
# only on files older than 30 days
if ( ( -M $_ ) > 30 ) {
@args = ("del", "/F", "/Q", "$_");
system @args;
}
}