Re: Windows paths in glob
- From: Dmitry <mitia2008.remove@xxxxxxxxx>
- Date: Mon, 31 Mar 2008 06:09:33 GMT
Gunnar Hjalmarsson <noreply@xxxxxxxxx> wrote in
news:65aa8vF2euim1U1@xxxxxxxxxxxxxxxxxx:
Dmitry wrote:
OK, so there's a well-known difficulty with handling Windows-style
paths in glob: it doesn't like backslashes, nor does it like spaces.
One solution to that is to use Unix-style paths:
glob('C:\Documents and Settings\*'); # Doesn't work
glob('C:/Documents\ and\ Settings/*'); # Works
Problem is, the rest of Perl's built-in file-handling functionality
behaves the other way around. For instance, with -d:
-d 'C:\Documents and Settings'; # Works
-d 'C:/Documents\ and\ Settings'; # Doesn't work
Question: is there any way to use the same path string with glob and
with the rest of Perl, without having to convert them back and forth?
A long time ago I decided to use opendir() and readdir() instead of
glob(). It may not be as 'elegant', but it works flawlessly without
escaping spaces.
OK, thanks. I guess if I wanted to process wildcards in the file name, I would pass them
through grep?
.
- Follow-Ups:
- Re: Windows paths in glob
- From: Joe Smith
- Re: Windows paths in glob
- References:
- Windows paths in glob
- From: Dmitry
- Re: Windows paths in glob
- From: Gunnar Hjalmarsson
- Windows paths in glob
- Prev by Date: Re: Windows paths in glob
- Next by Date: FAQ 8.5 How do I read just one key without waiting for a return key?
- Previous by thread: Re: Windows paths in glob
- Next by thread: Re: Windows paths in glob
- Index(es):
Relevant Pages
|