This also works and is more portable...
my $dir = 'C:/Program Files';
opendir DIR, $dir;
print map {"$dir/$_"} grep {/.+\..+/} readdir(DIR);
closedir DIR;
Rob
-----Original Message-----
From: Hanson, Rob
Sent: Friday, September 05, 2003 8:38 PM
To: [EMAIL PROTECTED]
Subject: RE: REPOST - print <c:\program files\*.*>;
Windows is a little weird here because of the way long filenames are
supported. You need to use the short name of the directory, which is the
first 6 letters - a tilda - and a number (always 1, unless there multiple
files with the same first 6 chars).
This works for me:
print <c:/progra~1/*.*>;
Rob
-----Original Message-----
From: Robert Citek [mailto:[EMAIL PROTECTED]
Sent: Friday, September 05, 2003 8:24 PM
To: [EMAIL PROTECTED]
Subject: Re: REPOST - print <c:\program files\*.*>;
Hello Edward,
At 05:07 PM 9/5/2003 +0800, Edward Yang wrote:
>The problem is I do not get correct result from the following code:
>print <c:\program files\*.*>;
>or
>print <c:\\program files\\*.*>;
I don't use perl in Windows, but I can simulate a similar result on Linux
or Mac OS X:
mkdir "foo bar"
cd "foo bar"
touch a b c
cd ..
perl -le 'print join("\n", <foo bar/*>);
I can get things to work by adding in two back slashes befor the space in
the name:
perl -le 'print join("\n", <foo\\ bar/*>);
Perhaps this will work with Windows as well.
Regards,
- Robert
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]