|There's more than one way to do things|
Re: Cannot copy files from linux shared to windowsby Loops (Curate)
|on Nov 05, 2014 at 11:17 UTC||Need Help??|
Hi bbb, welcome to the monastery.
Not sure what error you're hitting without having more information as the monks above mentioned. But thought a few small touches to your script, might get you closer to you finding the answer.
Tried to keep the bulk of your code, but did switch over to using autodie. It's not always appropriate to use, but here it lets us remove all your "or die..." statements and get down to the main code.
Removed the "$copylog" file, and just sent everything through STDERR using the warn command. Also was unsure why you had the "cp" line below the copy, but it wasn't helping. ;o)
And finally, your code would copy the file multiple times if it had more than one matching line. So here we add last after the first match, to tell Perl to leave the while loop and move on.
You may find that this still doesn't work in your environment, but if so, hopefully the error is a bit easier to suss out.
P.S. Since this is Perl and there is always more than one way to do it, you might find other CPAN options such as Path::Iterator::Rule more to your liking.
The only thing that may look out of place there is the eval block. This captures any failure of the copy, to let us report the result on the next line.