comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: file_search: need work around for filenames with square brackets [ ]
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: file_search: need work around for filenames with square brackets [ ] [message #66806] Sat, 06 June 2009 07:03 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rklein writes:

> the routines for reading FITS-files in the IDL astro library use
> file_search() internally. Now I want to read a file name with square
> brackets (as this "[" and " this" ]" ) in it, but file_search seems to
> interpret the square brackets as regular expression. Is there a way to
> escape the brackets?
> Other suggestions?
> I don't really want to change the library routines not rename the
> files I have to read.

Yeah, I hear you. I want to play tennis and hike in
the mountains instead of going to work every day. :-(

Have you tried a back slash as an escape character?

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: file_search: need work around for filenames with square brackets [ ] [message #66961 is a reply to message #66806] Mon, 15 June 2009 15:09 Go to previous message
rklein is currently offline  rklein
Messages: 5
Registered: June 2009
Junior Member
On Jun 6, 7:03 am, David Fanning <n...@dfanning.com> wrote:
> rklein writes:
>> the routines for reading FITS-files in the IDL astro library use
>> file_search() internally. Now I want to read a file name with square
>> brackets (as this "[" and " this" ]" ) in it, but file_search seems to
>> interpret the square brackets as regular expression. Is there a way to
>> escape the brackets?
>> Other suggestions?
>> I don't really want to change the library routines not rename the
>> files I have to read.
>
> Yeah, I hear you. I want to play tennis and hike in
> the mountains instead of going to work every day. :-(
>
> Have you tried a back slash as an escape character?

I'd rather go sailing, but could you come back from the tennis court
please and have a look at this idl journal:

; IDL Version 7.0, Microsoft Windows (Win32 x86 m32)
; Journal File for Administrator@FIFILSTEST
; Working directory: C:\FIFILS\Software\FlightSoftware
; Date: Mon Jun 15 21:58:08 2009

print,file_search("K:\OBSERVATIONS\archiveData
\20090403_095540\00098_153217_spiral162_@0078*")
;K:\OBSERVATIONS\archiveData
\20090403_095540\00098_153217_spiral162_@0078_[4,-4]_lw.dff
;K:\OBSERVATIONS\archiveData
\20090403_095540\00098_153217_spiral162_@0078_[4,-4]_lw.fit
;K:\OBSERVATIONS\archiveData
\20090403_095540\00098_153217_spiral162_@0078_[4,-4]_lw.rff
print,file_search("K:\OBSERVATIONS\archiveData
\20090403_095540\00098_153217_spiral162_@0078_\[4,-4\]_lw.df f ")
print,file_search("K:\OBSERVATIONS\archiveData
\20090403_095540\00098_153217_spiral162_@0078_/[4,-4/]_lw.df f ")
print,file_search('"K:\OBSERVATIONS\archiveData
\20090403_095540\00098_153217_spiral162_@0078_[4,-4]_lw.dff"')

Of course, I tried escaping the brackets, but it does not work as you
can see from the above. May be I should have mentioned that I am
running on Windows
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: map_proj_* help
Next Topic: IDLDOC 3.2 Index page not as interesting as it could be...

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:48:58 PDT 2025

Total time taken to generate the page: 0.00583 seconds