Dear Fellow Monks,
I've been racking my trying to figure out why the dircopy function of File::Copy::Recursive behaves in the following way with the below code:

#!/usr/bin/perl use strict; use File::Copy; use File::Copy::Recursive qw ( dircopy ); my $machine = Win32::NodeName; my $shop = substr($machine,0,4); my $snum = substr($machine,5); my $BOX1 = $shop . "1" . $snum; my $BOX2 = $shop . "2" . $snum; print " ###################\n"; print " # COPYING TIREPIX #\n"; print " ###################\n"; my $box1_tirepix_dir = "\\\\$BOX1\\e\\dbmonro\\tirepics"; my $box2_tirepix_dir = "\\\\$BOX2\\e\\dbmonro\\tirepics"; print "Copying from $box1_tirepix_dir to $box2_tirepix_dir\n"; print "Removing $box2_tirepix_dir\n"; system("rmdir /S /Q $box2_tirepix_dir") or print localtime()." in syst +em TIREPIX rmdir: $!\n"; sleep(10); print "creating directory $box2_tirepix_dir\n"; mkdir($box2_tirepix_dir) or print " in TIREPIX mkdir: $!\n"; dircopy($box1_tirepix_dir,$box2_tirepix_dir) || print " TIREPIX dircop +y: $!\n";

RESULTS:

  1. The tirepics directory is properly copied as expected with all directories and files.
  2. On computer 1, an added directory c:\SHOP20003 with only a directory structure and no files.
  3. Computer 1 is where the script it called from.

NOTES:

  1. There are 2 computers networked together. One named SHOP10003 and the other is SHOP20003.
  2. Computer 1 is where the script it called from.
  3. It appears that dircopy is producing a side-effect of copying the directory structure of the source directory but I don't know why. Any insights from my brethren would be appreciated.
Dave

In reply to File::Copy::Recursive dircopy side effect by niewczyk

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.