Based on what I see in the version I downloaded (File::Xcopy 0.11), this isn't ready for prime-time

The pattern matching doesn't work

The file copy seems to my eyes to be coded wrong. From Lines 362ff
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"; } }
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.

'./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'
Unless you want to get into the guts of this thing, I'd look for another solution.

- j


In reply to Re: File::Xcopy problem by jimbojones
in thread File::Xcopy problem by boat73

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.