I am setting up an FTP Server and I am working on a
script
that will remove all files in tmp that haven't been
Modified in the past
30 days (for house cleaning
purposes)
I found this code in O'Reilly's "Learning Perl on
Win32 Systems"
----------------------------------------------------------------------------------
open (FILETOCHECK,
"c:/test.txt");
if (-M FILETOCHECK > 30.0) {
die "Sorry, the file is older than 30
days\n";
} close FILETOCHECK;
-----------------------------------------------------------------------------------
Is it inefficient to open every file??? What
if it encounters
a 200 MB email log file, will it choke when trying
to open it?
I guess what I am saying is that when you use the open command does it literally load the file completely into
memory?
I found a way to use the Date::Calc module
along with the stat
function to do this (which avoids using "open") but
it is quite a few more
steps.
Any help would be greatly appreciated.
Also, I am using the system function with the DIR
/S /B
to build a list of all the files in the tmp
partition, is there a perl function
that does this a little
cleaner?
|