SPUG: Filehandes -- slurping up the files in \folder\*.htm?

ericd at webforia.com ericd at webforia.com
Wed Feb 9 21:03:49 CST 2000

There's also a Win32::ChangeNotification module that will let you monitor
events relating to files and directory trees.  It's available on both CPAN
and ActiveState.

-----Original Message-----
From: Greg Mushen [mailto:greg.mushen at gettyimages.com]
Sent: Wednesday, February 09, 2000 5:50 PM
To: 'Sean Owens (Entex)'; SPUG (E-mail)
Subject: RE: SPUG: Filehandes -- slurping up the files in \folder\*.htm?

Hi Sean,
To process all the files in a directory, your code should go something like
# This will open the directory
opendir(DIR, "<your-dir>") or die "Can't open dir: $!\n";
# This will go through each file in that directory.
while(defined ($file = readdir(DIR))) {
            open(FILE, "$file");
            do whatever else here
If you wanted to add functionality so that it only processes it when it has
been changed, you'd have to figure out how you wanted to approach it.  You
could get really complex or just check the modification time of the file and
process it if it is greater than 10 min or so using the -M file test switch.
Hope this helps,

-----Original Message-----
From: Sean Owens (Entex) [mailto:a-seano at microsoft.com]
Sent: Wednesday, February 09, 2000 4:52 PM
To: SPUG (E-mail)
Subject: SPUG: Filehandes -- slurping up the files in \folder\*.htm?

I'm sure there's a very simple answer, but I'm still a bit new at this perl
I want to sequentially read in all the files in a directory (there aren't
_that_ many, but I'm lazy and don't want to create a hash with all the
filenames listed), munge them, and save them out (then open the next one...
etc.).  Can I assign a variable to a filename on a server, or can I open it
some other way?  In this case my script always runs, and always processes
the files every 5-10 mintues
Even better, I'd like to have the munging happen only on change, so my
script always runs and only processes whenever necessary.  Now I'm really
out of my depth!
To make this even more fun (as you might guess from my email), I'm on a
Win32 system.
Can anyone point me in the right direction to get me started?  thanks!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/archives/spug-list/attachments/20000209/5ae9bab5/attachment.htm

More information about the spug-list mailing list