----- Original Message -----
From: "Sweet Gordon" <[EMAIL PROTECTED]>
To: "'perl-win32-userslistservActiveStatecom'"
<[EMAIL PROTECTED]>
Sent: Monday, December 04, 2000 5:32 PM
Subject: Dealing with a space in a directory name


> I'm using the globbing function to return a list of filenames from the
> specified directory (e.g. @filelist = <c:/perl/bin/*> and it's working
great
> unless the directory has a space in it's name (e.g. <c:/perl source/*>).
> I've played around with adding quotes but so far, nothing has worked. Any
> help would be appreciated.

Go to a command prompt and type a dir command of the parent directory with a
/x switch, ie.,

         dir c:\ /x

This will give you the 8.3 directory names which is what glob needs.  You
can get that progromatically using the GetShortPathName function.  Not
trying to worm down any further than the first level you could do something
like -

==================================================
$dir = "C:\\";
@root = glob("$dir\\*");
foreach $rootdir (@root)
 {
 if (grep(/ /, $rootdir)){$rootdir = Win32::GetShortPathName($rootdir);}
 @filenames = glob("$rootdir\\*");
 foreach $filename (@filenames){print "$filename\n";}
 }

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to