Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > File test Operator for Directory Age

Reply
Thread Tools

File test Operator for Directory Age

 
 
RickB
Guest
Posts: n/a
 
      02-06-2004
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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
POD and assignment operator and test operator Hicham Mouline C++ 2 09-01-2009 06:00 PM
print("my name is {name}, and {age}-year old {gender}", name, age, gender); =?iso-8859-1?B?bW9vcJk=?= Java 7 01-02-2006 04:39 PM
OK ... AGE FUNCTION TEST RESULTS ... Brynn ASP General 1 01-12-2004 04:56 PM
Can cout do like printf("Name: %s, Age: %d\n",name,age)? cylin C++ 6 08-19-2003 09:03 PM
test test test test test test test Computer Support 2 07-02-2003 06:02 PM



Advertisments