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. | [reply] [d/l] |
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.
| [reply] [d/l] [select] |
Thank you I will check that out! The joys of working on inherited code.
| [reply] |