R
RickB
Folks,
Sorry if this is too elemental. I am attempting to create some admin
scripts, among them the ability to delete folders older than X days.
Question: in the following code, what do I use to get the Age of a
Directory? I am using AcivePerl on Windows XP and Windows 2K.
use Win32;
use Win32::NetResource;
use Time::localtime;
# windows utility script for administration of disk space: delete old
# files/folders
$Name='C:\\Temp\\test';
if ( -d $Name )
{
# how to detect directory older than 2 weeks
print "Got a directory","\n";
}
else
{
if (-M $Name > 14)
{
# do good things for files older than 2 weeks
print "Got a file","\n";
}
}
exit 0;
Thank you in advance. I am new to Perl but am already a convert!
Sorry if this is too elemental. I am attempting to create some admin
scripts, among them the ability to delete folders older than X days.
Question: in the following code, what do I use to get the Age of a
Directory? I am using AcivePerl on Windows XP and Windows 2K.
use Win32;
use Win32::NetResource;
use Time::localtime;
# windows utility script for administration of disk space: delete old
# files/folders
$Name='C:\\Temp\\test';
if ( -d $Name )
{
# how to detect directory older than 2 weeks
print "Got a directory","\n";
}
else
{
if (-M $Name > 14)
{
# do good things for files older than 2 weeks
print "Got a file","\n";
}
}
exit 0;
Thank you in advance. I am new to Perl but am already a convert!