My suggestion would be to use File::Copy and File::Spec.

use File::Spec; use File::Copy; $folder1=File::Spec->catdir('//computerA','share','folder'); $folder2=File::Spec->catdir('//diffcomputer','share','new folder'); copy "$folder1/file.txt", "$folder2/new_file.txt" or die "Cannot copy +file.txt from $folder1 to $folder2. $!";

In that snippet, note the direction of the slashes for the computer name. It might seem backwards but it works. Also, using single quotes instead of double quotes means that the slashes won't get interpolated. And this does work, we do it all the time, every day in fact. All our scripts use UNC or absolute pathnames (Windows or Unix). What you may be running into is a problem with the space in the "other folder" name. Just a hunch, it causes us problems with some things unless we specially wrap double quotes around it to get it to work right. Hope that helps.

update: My mistake, I misread. I thought you were talking about files, not directories.


In reply to Re: Difficulties in copying directories from one network drive to another. by nimdokk
in thread Difficulties in copying directories from one network drive to another. by doowah2004

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.