Hi, I am trying to copy some file from a removable HDD to a network drive. I want replicate the directory structure and omit un-needed files.
The directory paths a 4-5 levels deep and I am trying to work out an efficient way to recreate the directory path. What I've been doing is using File::Find to collect the file and then in the coderef calling the following subroutine to check the path but i didn't go too far as my method seems....well not well formed. The path to a source file looks like: e:/Dir1/Day 1/AM/01/myfile.jpg use strict; use warnings; ... ...snip sub check_dir { # @_ = File::Find::dir my $path = shift; return unless (-e $path); # Split the path on it's parts. my @parts = split('/',$path); # Loop from 1 to skip the first part of the path. for (my $i = 1; $i <= $#parts; ++$i) { my $l = $dist.'/'.$parts[$i]; if (! -e $l) { print "Checking $l\n"; my $j = $i + 1; # urg! my $lev = $dist.'/'.$parts[$i].'/'.$parts[$j]; if (! -e $lev) { print "Checking $lev\n"; } } } Can anyone offer me some advice with this? Thanx, Dp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/