Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Copy Folder Preserve Attributes

by Anonymous Monk
on Dec 08, 2017 at 22:41 UTC ( [id://1205206]=note: print w/replies, xml ) Need Help??


in reply to Re: Copy Folder Preserve Attributes
in thread Copy Folder Preserve Attributes

Thanks for the feedback! I tried removing -c but it doesn't work. Even if I remove all of the flags except for -r it still fails.

Your comment got the creative juices flowing in a different direction though. I ended up changing the command to use robocopy instead of cp and it finally worked.
my @args = ('robocopy', '/mir', $self->{publicDir}, $oldPublic);
Most of my perl code is written for linux so maybe this was a rookie mistake trying to run cp using a system command in a perl program run in windows.

Replies are listed 'Best First'.
Re^3: Copy Folder Preserve Attributes
by pryrt (Abbot) on Dec 08, 2017 at 23:14 UTC

    Since cp is not a builtin Windows command, it wasn't going to work, no matter what options you passed to it, unless you had something like gnuwin32 CoreUtils installed.

    When I ran a stripped down version of your code, with or without use warnings; use strict; (in my instance, calling a non-existent executable zzzcp, since I have CoreUtils' cp in my path), STDERR informed me that

    'zzzcp' is not recognized as an internal or external command, operable program or batch file.
    Thus, your tk gui is apparently not trying to capture your script's STDERR and log it somewhere useful. You may want to consider doing that, because if you had been, the error would have been with the rest of your error log. This may help you catch future errors, especially if you're shelling out for more than just the recursive copying. Search for "redirect" in open to see how to redirect STDERR to a file, and "in-memory files" in case you wanted to redirect STDERR to a string, so that you can then use your DDialog methods to do the logging.

      Thank you I will check that out! The joys of working on inherited code.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1205206]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-03-28 19:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found