in reply to copying multiple files from a share

Did you manage to copy multiple files not from a share?

You need to do the same thing here. Two things to keep in mind: Perl-the-language doesn't have a command to copy multiple files; you need to use a glob or possibly use readdir and choose files yourlsef; and (as you are aware) you need to escape the backslash (or just use a forward slash instead).

Something like this should work, but is untested.

use File::Copy; my $to = 'd:/temp/logs/"; foreach my $from (glob '//amsepi01/logs$/*.gz') { copy($from, $to) or die "copy: $!"; }

Replies are listed 'Best First'.
Re^2: copying multiple files from a share
by cmeena (Initiate) on Mar 10, 2005 at 16:36 UTC
    The above code worked. All I have to change was escape the $ sign like logs\$. Thanks for your help.
      You're welcome!

      I'm wondering why you needed to escape the $ though, since it was single-quoted.