CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Comparing files for their times??



Sep 26, 2002, 8:47 PM

Post #1 of 4 (658 views)
Comparing files for their times?? Can't Post


well I am new to the perl world but I want to learn and the first thing I wanted to do is compare files for their time and if the file is more then six hours old have that file replaced with another file.

My problem is I just started taking care of a web site that had about 20 web cams and what I would like to do rather then looking through all the pictures one at a time to see how old is it, have a script look through the picture files and look at the time stamp if it more then 6 hours old have that picture replaced with an out of service picture.



Sep 26, 2002, 9:01 PM

Post #2 of 4 (656 views)
Re: [castro] Comparing files for their times?? [In reply to] Can't Post

You'll prolly wanna use these functions

opendir, readdir, and closedir or glob
open, binmode, readline, close

you use the opendir ...
to retrieve a list of files

you use open ...
to copy files

you use stat to get the attributes of a file,
such as a create time

try `perldoc -f functionname'
on the commandline to see how to use each of these

after that, its only a matter of

if( $createtime > 60 * 60 * 6 ) { 
# copy file with open,binmode,close

Good Luck!


Sep 26, 2002, 9:15 PM

Post #3 of 4 (654 views)
Re: [thebitch] Comparing files for their times?? [In reply to] Can't Post

Hay thanx,

My knowlege on the commands is very low the once I know are the opne and close, but the rest is unfamiliar. Where can I look up those commands? Or may be if you can put something toghether for me real quick, I would very much appreciate it. What's a good way to learn perl? Books? or any websites other then this?



(This post was edited by castro on Sep 26, 2002, 9:17 PM)

Thaumaturge / Moderator

Sep 27, 2002, 1:22 AM

Post #4 of 4 (651 views)
Re: [castro] Comparing files for their times?? [In reply to] Can't Post

Everything you need is installed with Perl. Type "perldoc perl" to get an introduction to Perl and pointers to the dozens of other manual pages available.

They are also available online at

Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives