ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> activeperl
activeperl
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved