Are you basically looking for a Directory Traversing script? There is a great example within O'reilly's Programming Perl for the System Administrator, I think thats the title, anyway I have already trasnferred the code to a script that I use. If you want I can send it to you, It does work wonders for ripping through multiple directoies and processing mutiple files.
DK -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Wening Andreas Sent: Monday, April 15, 2002 7:24 AM To: '[EMAIL PROTECTED]' Subject: Simple: Read a text file Hi, I think this is a simple one but I guess I'm blind and need some help. I have a directory full of files and want to look into each file for a specific string, as soon as I found this I would like to do some actions (move its to another folder) and go over to the next file. With the while statement I always read through the whole file. Any suggestions? ==snip=== $badmail = "C:\\something"; $search = "some string"; opendir (h_dir, $badmail) or die "Can't open $badmail, $!\n"; @dir = readdir h_dir; foreach $file (@dir) { if (-d $file) {next} else { $flag = 0; $filename = c_smtpssl_badmail.$file; open h_file, "<$filename" or die "Can't open file $filename, $!\n"; while (<h_file>) { if (/$search/) {$flag = 1} } close h_file; } if ($flag) { move ($filename, $location1.$filename); } else { move ($filename, $location2.$filename); } } closedir h_dir; ==snip=== _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
