Another alternative GO NATIVE
use warnings;use strict;
my ($share, $in, $drive, $cmd);
print "Enter path\n";$share = <STDIN>;chomp $share;$share = ('"' . $share .
'"');system ("net use * $share > tmp.txt");$in = "tmp.txt";open(IN, "<$in")||
die ("Open of $in failed");while (<IN>) { chomp; print "$_\n"; if
(/Drive.*/) { /Drive.(.*).is now.*/; $drive = $1; }}if (!$drive) {
print "Invalid path\n"; die;}system ("dir /B $share");#remove the drive map
& delete tmp.txtsystem ("net use $drive /delete");unlink (tmp.txt);
You could likely get glob to work by enclosing the path string in quotes as
above in net use
Steve
> From: [EMAIL PROTECTED]> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]> Subject:
> RE: glob doesn't work on UNC paths?> Date: Wed, 7 Mar 2007 08:20:09 -0800> >
> On Wed, 07 Mar 2007, Roode, Eric wrote:> > Steve Stewart wrote:> >> > > Just
> a thought, why not use the short names for the directories i.e.> > Program
> Files = Progra~1, New Folder = newfol~1 ect you can list them> > using cmd
> dir /x this should solve it unless it is actually the share> > names that are
> causing the problem, in which case you can either> > rename the share or use
> the admin shrare C$, D$ and so on of course> > you need to have admin access
> to do this> >> > In my case, I'm taking the input from the user, and I can't
> reasonably> > ask them to do a dir/x first. :-)> > But you can always call
> Win32::GetShortPathName() yourself:> > C:\usr\bin>perl -we "print
> Win32::GetShortPathName('\\\\zoom\my\New Folder')"> \\zoom\my\NEWFOL~1> >
> Cheers,> -Jan> > _______________________________________________> ActivePerl
> mailing list> [email protected]> To unsubscribe:
> http://listserv.ActiveState.com/mailman/mysubs
> From: [EMAIL PROTECTED]> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]> Subject:
> RE: glob doesn't work on UNC paths?> Date: Wed, 7 Mar 2007 08:20:09 -0800> >
> On Wed, 07 Mar 2007, Roode, Eric wrote:> > Steve Stewart wrote:> >> > > Just
> a thought, why not use the short names for the directories i.e.> > Program
> Files = Progra~1, New Folder = newfol~1 ect you can list them> > using cmd
> dir /x this should solve it unless it is actually the share> > names that are
> causing the problem, in which case you can either> > rename the share or use
> the admin shrare C$, D$ and so on of course> > you need to have admin access
> to do this> >> > In my case, I'm taking the input from the user, and I can't
> reasonably> > ask them to do a dir/x first. :-)> > But you can always call
> Win32::GetShortPathName() yourself:> > C:\usr\bin>perl -we "print
> Win32::GetShortPathName('\\\\zoom\my\New Folder')"> \\zoom\my\NEWFOL~1> >
> Cheers,> -Jan> > _______________________________________________> ActivePerl
> mailing list> [email protected]> To unsubscribe:
> http://listserv.ActiveState.com/mailman/mysubs
_________________________________________________________________
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs