Re: Problem with Win32::FileOp->Disconnect
by Jenda Krynicky other posts by this author
Jun 18 2009 5:25AM messages near this date
Problem with Win32::FileOp->Disconnect
|
RE: Problem with Win32::FileOp->Disconnect
From: "Oeschey, Lars (I/ET-83, extern)" <extern.Lars.Oeschey@[...].DE>
> 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
===== Jenda@[...].cz === 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
ActivePerl@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Lars Oeschey
Jenda Krynicky
Lars Oeschey
Ramkumar
|