Re: file_search: need work around for filenames with square brackets [ ] [message #66960 is a reply to message #66959] |
Mon, 15 June 2009 15:23  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
rklein writes:
> 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
Well, I don't know. I'm running on Windows, too, and
I have absolutely no problems finding these files:
IDL> files = file_search("c:\temp", '00098_153217*', COUNT=count)
IDL> print, count
2
IDL> for j=0,1 do print, files[j]
C:\temp\00098_153217_spiral162_@0078_[4,-4]_lw.dff
C:\temp\00098_153217_spiral162_@0078_[4,-4]_lw.fit
This is Windows XP and IDL 7.0.4.
I think this might be a Windows problem, not IDL.
Cheers,
David
--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|