It should do exactly what you need, I do this routinely. The following is a very basic sample, but might help get you started.
use File::Find; # calls wanted() for each file found find(\&wanted, '/var/log'); sub wanted { # check to see if the file exists, could be # used instead to skip binary files, or whatever. return unless -e $_; # $File::Find::name is the full path my $target = my $src = $File::Find::name; # modify the target path as needed $target = s|^/var/log|/export/log|; # read in the source open IN, $src or die $!; my @lines = <IN>; close IN; # modify the src as needed @lines = map {s/foo/bar/} @lines; # write contents to target open OUT, "> $target" or die $!; print OUT @lines; close OUT; } -----Original Message----- From: Kristian Rink [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 7:13 AM To: [EMAIL PROTECTED] Subject: Re: looking through directories recursively Hi there, and thanks for the hint... > On Mon, 03 Mar 2003 12:11:51 +0100, Kristian Rink wrote: [snip] > The easiest way is nearly always to use the existing module > File::Find > for handling recursive directory/file structures. I'm by now trying to figure out about what File:Find is capable of doing. Actually, the script, once done, is intended to make a copy of a directory subtree in a different place of the file system (for example copy /var/log do /export/log) _and_ to modify each regular file found in each of the sub directories. I will see whether File::Find is suitable for this... Thanks anyhow, have a calm week out there. :) Cheers, Kris -- +++ GMX - Mail, Messaging & more http://www.gmx.net +++ Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]