From: "Oeschey, Lars (I/ET-83, extern)" <[email protected]>
> 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;
$lettermatch = $key;
> print "..........Already Mapped!!.........\n";
> }
> }
>
> if ($lettermatch==1) {
if ($lettermatch) {
> print "Disconnecting $path\n";
> Disconnect $path, {persistent=>1,force=>1} or &ConnError;
print "Disconnecting $path as $lettermatch\n";
Disconnect $lettermatch, {persistent=>1,force=>1} or &ConnError;
> }
Try to disconnect the drive letter, not the share. I think if you
specify the share, it breaks the connection (the server will no
longer see this computer among the connected ones, no files will be
open etc.), but doesn't remove the drive letter mapping.
Let me know if it helped and I'll update the docs.
Jenda
===== [email protected] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs