in reply to File::Xcopy problem
The "to" file ($f2) is never set. Also, looking at the data dump of the $rr hash, the "to" directory "t_pdir" is empty if the file doesn't exist in the "to" directory. Hence you could never copy files that didn't already exist in the "to" directory.foreach my $f (sort keys %{$rr}) { ++$m; $tp = ${$rr}{$f}{type}; # skip if the file only exists in to_dir next if ($tp =~ /^OLD/); $f1 = "${$rr}{$f}{f_pdir}/$f"; $f1 = "${$rr}{$f}{t_pdir}/$f"; ########## Jimbojones comment -- note that $f2 is never set. # +###### if ($act =~ /^c/i) { # copy ++$n; copy $f1, $f2 if $tp =~ /^(NEW|EX1|EX2)/; } elsif ($act =~ /^m/i) { # move ++$n; copy $f1, $f2 if $tp =~ /^(NEW|EX1|EX2)/; move $f1; } elsif ($act =~ /^u/i) { # update ++$n; copy $f1, $f2 if $tp =~ /^(EX1|EX2)/; } elsif ($act =~ /^o/i) { # overwirte ++$n; copy $f1, $f2 if $tp =~ /^(EX0|EX1|EX2)/; } else { carp "WARN: $f - do not know what to do.\n"; } }
Unless you want to get into the guts of this thing, I'd look for another solution. - j'./Temp.txt' => HASH(0x22d1f6c) 'action' => 'CP' 'f_pdir' => 'C:/TEMP' 'f_size' => 0 'f_time' => 20041216.141033 'file' => 'Temp.txt' 'szdiff' => '' 't_pdir' => '' #-- Jimbojones comment. Null, should be 'C:/temp2' 't_size' => '' 't_time' => '' 'tmdiff' => '' 'type' => 'NEW'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: File::Xcopy problem
by boat73 (Scribe) on Dec 17, 2004 at 12:25 UTC |