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

What is the perferred method to mapping Windows network drivers? I've listed the three options below. Evadently, there is problem copying file from a UNC path. <code> 1. NetUse 2. Win32::OLE 3. File::Op <\code> Help would be greatly appreciated. Drod

Replies are listed 'Best First'.
Re: Another Windows Mapping Question
by ikegami (Patriarch) on Sep 24, 2008 at 23:28 UTC

    Evadently, there is problem copying file from a UNC path.

    I don't see how it's evident, or even true.

    C:\>md foo C:\>md bar C:\>copy nul foo\file 1 file(s) copied. C:\>perl -MFile::Copy -e"copy @ARGV" \\127.0.0.1\c$\foo\file \\127.0.0 +.1\c$\bar" C:\>dir /b bar file
      How would it look in the actual script?
        #!/usr/bin/perl use strict; use warnings; use File::Copy qw( copy ); copy $ARGV[0], $ARGV[1];

        It needs error checking.

        If you need to hardcode a UNC path, you can either properly escape backslashes

        my $path = '\\\\server\\share\\dir\\file';

        or simply use forward slashes.

        my $path = '//server/share/dir/file';

        open has no problem with either.