Hi,
I'm writing a simple network copy script, but fail at disconnecting an
already connected drive. I got this so far:
----------------snip------------------------
use strict;
use warnings;
use Win32::FileOp;
my $user="xx";
my $password="xx";
my $path="\\\\deaudiis0957\\oeschela\$";
my $lettermatch=0;
print "Using User: $user\n";
print "Using Path: $path\n";
print "Checking mapped drives....\n";
my %mapped=Mapped;
while((my $key, my $value) = each(%mapped)) {
print "$value\n";
if (lc($value) eq lc($path)) {
$lettermatch=1;
print "..........Already Mapped!!.........\n";
}
}
if ($lettermatch==1) {
print "Disconnecting $path\n";
Disconnect $path, {persistent=>1,force=>1} or &ConnError;
}
sub ConnError{
my $err=Win32::FormatMessage(Win32::GetLastError());
print $err;
print "Win32Error: $err\n";
exit 1;
}
--------------snip--------------------
when I run it, it finds the mapped drive, but fails on disconnecting it:
Using User: deaudi00\oeschela
Using Path: \\deaudiis0957\oeschela$
Checking mapped drives....
\\DEAUDIIS0957\Oeschela$
..........Already Mapped!!.........
Disconnecting \\deaudiis0957\oeschela$
Diese Netzwerkverbindung ist nicht vorhanden.
Win32Error: Diese Netzwerkverbindung ist nicht vorhanden.
(translated it says "This network connection doesn't exist")
Any ideas what goes wrong here?
Lars
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs