Filtering File Names with Dialog_Pickfile [message #60671] |
Thu, 12 June 2008 05:23  |
Spon
Messages: 178 Registered: September 2007
|
Senior Member |
|
|
Hi,
our archive has a large folder that holds all our data folders (this
is a requirement of our data acquisition software). These folders tend
to have names that start with a researcher's initials, e.g.
'RB1006_17.Xz0'.
Is there any clever way to get Dialog_Pickfile to display only certain
folders as defined by a regexp? Unfortunately very little can be
gleaned from the extension, which the acquisition software allocates
by some mystic method, and cannot be changed unless I never want that
software to recognise the data folder ever again (I _DON'T_ want to do
this...)
I've been playing around with the FILE and FILTER keywords, but they
only seem to control file extensions, and are unable to filter by
searching the file name.
What I'm looking for is something like this:
CD, ArchiveDir
Dir = Dialog_Pickfile(/Read, /Must_Exist, /Dir, Filter = 'RB*.*')
That would show only those sub-folders within ArchiveDir that have
'RB' in their name. But it doesn't work. Neither with nor without /
Directory set.
I'd rather not have to write my own pickfile widget if there's a
clever way of using the inbuilt one :-)
Thanks,
Chris
|
|
|
Re: Filtering File Names with Dialog_Pickfile [message #60810 is a reply to message #60671] |
Fri, 13 June 2008 08:59  |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On Jun 13, 7:05 am, Spon <christoph.b...@gmail.com> wrote:
> On Jun 13, 2:42 am, Andrew Cool <andrew.c...@dsto.defence.gov.au>
> wrote:
>
>
>
>> On Jun 12, 9:23 pm, Spon <christoph.b...@gmail.com> wrote:
>
>>> Hi,
>
>>> our archive has a large folder that holds all our data folders (this
>>> is a requirement of our data acquisition software). These folders tend
>>> to have names that start with a researcher's initials, e.g.
>>> 'RB1006_17.Xz0'.
>
>>> Is there any clever way to get Dialog_Pickfile to display only certain
>>> folders as defined by a regexp? Unfortunately very little can be
>>> gleaned from the extension, which the acquisition software allocates
>>> by some mystic method, and cannot be changed unless I never want that
>>> software to recognise the data folder ever again (I _DON'T_ want to do
>>> this...)
>
>>> I've been playing around with the FILE and FILTER keywords, but they
>>> only seem to control file extensions, and are unable to filter by
>>> searching the file name.
>
>>> What I'm looking for is something like this:
>
>>> CD, ArchiveDir
>>> Dir = Dialog_Pickfile(/Read, /Must_Exist, /Dir, Filter = 'RB*.*')
>
>>> That would show only those sub-folders within ArchiveDir that have
>>> 'RB' in their name. But it doesn't work. Neither with nor without /
>>> Directory set.
>>> I'd rather not have to write my own pickfile widget if there's a
>>> clever way of using the inbuilt one :-)
>
>>> Thanks,
>>> Chris
>
>> Chris,
>
>> Are you sure that Dialog_pickfile is want you want to use?
>
>> IDL> cdir = file_search('C:\c*',/test_dir)
>> IDL> print,cdir
>> C:\CR C:\Cool
>> IDL> help,cdir
>> CDIR STRING = Array[2]
>
>> This returns just the two directories on my C:\ drive that start with
>> 'c'
>
>> Cheers,
>
>> Andrew
>
> Thanks Bob, Vince & Andrew, all very helpful suggestions.
>
> Well spotted, Vince, it's ParaVision. Thanks for the info regarding
> filenames. Makes sense now that I look back on it!
>
> The symbolic link idea is good. How cross-platform compatible is it?
> Our archive is linux, but our users use macs & windows boxes.
> I think Andrew's idea of using File_Search (and then a combobox, I
> guess) looks very promising though, so that's my first port of call.
>
> Thanks,
> Chris
How cross-platform compatible is it? NOT.
We have the same issues. What you can do is use symbolic links to
"fool" the paravision system, and move the files/directories wherever
you want.
%> cd /opt/PV3.0.2/username
%> ln -s ArchiveDir nmr [now paravision will store data in ArchiveDir
- we do this for everyone so that they all use the same folder]
Then...
%> cd ArchiveDir
%> mv RB1006_17.Xz0 /where/I/really/want/the/data/RB1006_17
%> ln -s /where/I/really/want/the/data/RB1006_17 RB1006_17.Xz0
Of course you can automate this using shell-scripts, etc.
|
|
|
Re: Filtering File Names with Dialog_Pickfile [message #60812 is a reply to message #60671] |
Fri, 13 June 2008 05:05  |
Spon
Messages: 178 Registered: September 2007
|
Senior Member |
|
|
On Jun 13, 2:42 am, Andrew Cool <andrew.c...@dsto.defence.gov.au>
wrote:
> On Jun 12, 9:23 pm, Spon <christoph.b...@gmail.com> wrote:
>
>
>
>> Hi,
>
>> our archive has a large folder that holds all our data folders (this
>> is a requirement of our data acquisition software). These folders tend
>> to have names that start with a researcher's initials, e.g.
>> 'RB1006_17.Xz0'.
>
>> Is there any clever way to get Dialog_Pickfile to display only certain
>> folders as defined by a regexp? Unfortunately very little can be
>> gleaned from the extension, which the acquisition software allocates
>> by some mystic method, and cannot be changed unless I never want that
>> software to recognise the data folder ever again (I _DON'T_ want to do
>> this...)
>
>> I've been playing around with the FILE and FILTER keywords, but they
>> only seem to control file extensions, and are unable to filter by
>> searching the file name.
>
>> What I'm looking for is something like this:
>
>> CD, ArchiveDir
>> Dir = Dialog_Pickfile(/Read, /Must_Exist, /Dir, Filter = 'RB*.*')
>
>> That would show only those sub-folders within ArchiveDir that have
>> 'RB' in their name. But it doesn't work. Neither with nor without /
>> Directory set.
>> I'd rather not have to write my own pickfile widget if there's a
>> clever way of using the inbuilt one :-)
>
>> Thanks,
>> Chris
>
> Chris,
>
> Are you sure that Dialog_pickfile is want you want to use?
>
> IDL> cdir = file_search('C:\c*',/test_dir)
> IDL> print,cdir
> C:\CR C:\Cool
> IDL> help,cdir
> CDIR STRING = Array[2]
>
> This returns just the two directories on my C:\ drive that start with
> 'c'
>
> Cheers,
>
> Andrew
Thanks Bob, Vince & Andrew, all very helpful suggestions.
Well spotted, Vince, it's ParaVision. Thanks for the info regarding
filenames. Makes sense now that I look back on it!
The symbolic link idea is good. How cross-platform compatible is it?
Our archive is linux, but our users use macs & windows boxes.
I think Andrew's idea of using File_Search (and then a combobox, I
guess) looks very promising though, so that's my first port of call.
Thanks,
Chris
|
|
|
Re: Filtering File Names with Dialog_Pickfile [message #60813 is a reply to message #60671] |
Thu, 12 June 2008 18:42  |
Andrew Cool
Messages: 219 Registered: January 1996
|
Senior Member |
|
|
On Jun 12, 9:23 pm, Spon <christoph.b...@gmail.com> wrote:
> Hi,
>
> our archive has a large folder that holds all our data folders (this
> is a requirement of our data acquisition software). These folders tend
> to have names that start with a researcher's initials, e.g.
> 'RB1006_17.Xz0'.
>
> Is there any clever way to get Dialog_Pickfile to display only certain
> folders as defined by a regexp? Unfortunately very little can be
> gleaned from the extension, which the acquisition software allocates
> by some mystic method, and cannot be changed unless I never want that
> software to recognise the data folder ever again (I _DON'T_ want to do
> this...)
>
> I've been playing around with the FILE and FILTER keywords, but they
> only seem to control file extensions, and are unable to filter by
> searching the file name.
>
> What I'm looking for is something like this:
>
> CD, ArchiveDir
> Dir = Dialog_Pickfile(/Read, /Must_Exist, /Dir, Filter = 'RB*.*')
>
> That would show only those sub-folders within ArchiveDir that have
> 'RB' in their name. But it doesn't work. Neither with nor without /
> Directory set.
> I'd rather not have to write my own pickfile widget if there's a
> clever way of using the inbuilt one :-)
>
> Thanks,
> Chris
Chris,
Are you sure that Dialog_pickfile is want you want to use?
IDL> cdir = file_search('C:\c*',/test_dir)
IDL> print,cdir
C:\CR C:\Cool
IDL> help,cdir
CDIR STRING = Array[2]
This returns just the two directories on my C:\ drive that start with
'c'
Cheers,
Andrew
|
|
|
Re: Filtering File Names with Dialog_Pickfile [message #60817 is a reply to message #60671] |
Thu, 12 June 2008 12:18  |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On Jun 12, 7:23 am, Spon <christoph.b...@gmail.com> wrote:
> Hi,
>
> our archive has a large folder that holds all our data folders (this
> is a requirement of our data acquisition software). These folders tend
> to have names that start with a researcher's initials, e.g.
> 'RB1006_17.Xz0'.
>
> Is there any clever way to get Dialog_Pickfile to display only certain
> folders as defined by a regexp? Unfortunately very little can be
> gleaned from the extension, which the acquisition software allocates
> by some mystic method, and cannot be changed unless I never want that
> software to recognise the data folder ever again (I _DON'T_ want to do
> this...)
>
> I've been playing around with the FILE and FILTER keywords, but they
> only seem to control file extensions, and are unable to filter by
> searching the file name.
>
> What I'm looking for is something like this:
>
> CD, ArchiveDir
> Dir = Dialog_Pickfile(/Read, /Must_Exist, /Dir, Filter = 'RB*.*')
>
> That would show only those sub-folders within ArchiveDir that have
> 'RB' in their name. But it doesn't work. Neither with nor without /
> Directory set.
> I'd rather not have to write my own pickfile widget if there's a
> clever way of using the inbuilt one :-)
>
> Thanks,
> Chris
If this is a *nix system you could use symbolic links.
Is this a ParaVision system. The extension is: the first two
characters are the date. The third character is the scan (what we
call scan - paravision may know it as study?)
So yesterday (June 11, 2008) was .NQ ... Today is .NR (I'm not sure if
yours has the same sequence, but it goes a-z then A-Z for each
character. Then the scans today are .NR1, .NR2, .NR3...
|
|
|
Re: Filtering File Names with Dialog_Pickfile [message #60818 is a reply to message #60671] |
Thu, 12 June 2008 12:00  |
Bob[3]
Messages: 60 Registered: December 2006
|
Member |
|
|
On Jun 12, 8:23 am, Spon <christoph.b...@gmail.com> wrote:
> Is there any clever way to get Dialog_Pickfile to display only certain
> folders as defined by a regexp?
On my system (WinXP) Dialog_Pickfile will not filter directory/folder
names at all - even by extension.
Can you rearrange the directory tree at all? Maybe putting all the
RB*.* folders (or links to them) into a RB folder, and then do your
regex filtering via a CD command before the pickfile.
A Dir_Filter keyword would be a nice feature tho - too bad it doesn't
exist.
|
|
|
Re: Filtering File Names with Dialog_Pickfile [message #60907 is a reply to message #60671] |
Thu, 12 June 2008 08:53  |
Jean H.
Messages: 472 Registered: July 2006
|
Senior Member |
|
|
Spon wrote:
> Hi,
>
> our archive has a large folder that holds all our data folders (this
> is a requirement of our data acquisition software). These folders tend
> to have names that start with a researcher's initials, e.g.
> 'RB1006_17.Xz0'.
>
> Is there any clever way to get Dialog_Pickfile to display only certain
> folders as defined by a regexp? Unfortunately very little can be
> gleaned from the extension, which the acquisition software allocates
> by some mystic method, and cannot be changed unless I never want that
> software to recognise the data folder ever again (I _DON'T_ want to do
> this...)
>
> I've been playing around with the FILE and FILTER keywords, but they
> only seem to control file extensions, and are unable to filter by
> searching the file name.
>
> What I'm looking for is something like this:
>
> CD, ArchiveDir
> Dir = Dialog_Pickfile(/Read, /Must_Exist, /Dir, Filter = 'RB*.*')
>
> That would show only those sub-folders within ArchiveDir that have
> 'RB' in their name. But it doesn't work. Neither with nor without /
> Directory set.
> I'd rather not have to write my own pickfile widget if there's a
> clever way of using the inbuilt one :-)
>
> Thanks,
> Chris
Hi Chris,
I doubt you can filter the folder names... it would be easy to get stuck
in the wrong folder and have nothing to display in the dialog box...
which is unwanted by most users.
An easy trick would be to have a routine that creates in a different
folder a file (not a folder, whatever extension) of the same name as
your sub-folders. Then you can filter the name of these files. Once
selected, remove the extension you have added, get the name of the
folder and save it..
Jean
|
|
|