mhoang has asked for the wisdom of the Perl Monks concerning the following question:

Hi Cowboys!

I try to use File:Copy:Recursive dircopy to copy the entire directory from site one to site two. It is working for the first time only. My question is will this package allow me to update the directory two recursively?.

Or can you recommend any other method for recursiveley to update the second directory with the info from the first.

My script is:
my $source ='K:\\Courses of Study\\curriculum mapping\\'; my $target='C:\\docs\\curriculum maps resources'; print "$source directory does not exist" unless (-d $source); print "Copying under progress for roughly 1 hour...\n"; File::Copy::Recursive::dircopy $source, $target or die "Copy failed: $ +!\n";

Replies are listed 'Best First'.
Re: Directory recursively copy
by BrowserUk (Patriarch) on Jun 08, 2010 at 02:14 UTC

    Type help replace on your command line. Something like

    replace /s /u "K:\Courses of Study\curriculum mapping\*" "C:\\docs\\cu +rriculum maps resources"

    Might be all you need.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Directory recursively copy
by sflitman (Hermit) on Jun 08, 2010 at 05:35 UTC
    If you run dircopy again, you will probably overwrite files, similar to rsync but without the smartness. There is a flag you can set locally to determine if target files should be removed, but I suspect there may be problems on a non-POSIX setup like Windows.

    I think the best way to handle this on Windows is probably xcopy, which you can call in a shell using backticks or system.

    http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx

    As St. Larry says, be lazy, don't reinvent the wheel!

    HTH,
    SSF

      all right, thank you all cowboys!! :)