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

Home » Public Forums » archive » Making a directory in an IDL routine.
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
Making a directory in an IDL routine. [message #10444] Thu, 04 December 1997 00:00 Go to next message
D.Kennedy is currently offline  D.Kennedy
Messages: 26
Registered: January 1997
Junior Member
An usual request -
Does anyone know how to make a directory from inside an IDL
routine? I know its odd, but its the best way to organise
a huge save set that'll be generated.

(And better yet, how to check if such a directory already
exists).

I imagine that this is machine dependant - UNIX answers
only needed.

--
David Kennedy, Dept. of Pure & Applied Physics, Queen's University of Belfast
Email: D.Kennedy@Queens-Belfast.ac.uk | URL: http://star.pst.qub.ac.uk/~dcjk/
My .sig was so clever that it actually escaped!
Re: Making a directory in an IDL routine. [message #10521 is a reply to message #10444] Sun, 07 December 1997 00:00 Go to previous messageGo to next message
gurman is currently offline  gurman
Messages: 82
Registered: August 1992
Member
In article <34870691.0@cfanews.harvard.edu>, rpete@ascda3.harvard.edu
(Pete Ratzlaff) wrote:

> David Kennedy (D.Kennedy@qub.ac.uk) wrote:
>> An usual request -
>> Does anyone know how to make a directory from inside an IDL
>> routine? I know its odd, but its the best way to organise
>> a huge save set that'll be generated.
>
>> (And better yet, how to check if such a directory already
>> exists).
>
>> I imagine that this is machine dependant - UNIX answers
>> only needed.
>
> 'spawn' can do both of these
>
> 1. To check if a directory exists:
> IDL> dir='/home/me/mydir'
> IDL> spawn, 'ls -a '+dir, result

This is better than findfile? I understand the latter has trouble with
UFS directories with lots of entries, but still....
>
> Now, check the length of RESULT[0]. If it is zero, then
> DIR doesn't exist, otherwise DIR does exist.
>
> 2. To create a directory
> IDL> spawn,'mkdir '+dir
>
> This may not be elegant, but it works.

The best part about findfile is that it's (relatively) OS-independent,
and even has a keyword, COUNT, that is ero indicates there are no files
meeting the filepath specification in the argument:

IDL> result = FINDFILE('<filespec>', COUNT = count)

e.g.

IDL> result = FINDFILE('/home/me/mydir', COUNT = count)

For some bizarre reason, the Digital UNIX version of IDL 5.0.3 cannot
resolve "~<homedirectory>" in findfile --- you have to state explicitly
where the home directory lives.

FWIW,

Joe Gurman

--
Joseph B. Gurman / NASA Goddard Space Flight Center/ Solar Data Analysis Center / Code 682 / Greenbelt MD 20771 USA / gurman@gsfc.nasa.gov / gurman@ari.net
| Federal employees are still prohibited from holding opinions while at work. Any opinions expressed herein must therefore be someone else's. | SPAMbot trap: abuse@127.0.0.1
Re: Making a directory in an IDL routine. [message #10559 is a reply to message #10444] Mon, 15 December 1997 00:00 Go to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Joseph B. Gurman wrote:
[...]

> For some bizarre reason, the Digital UNIX version of IDL 5.0.3 cannot
> resolve "~<homedirectory>" in findfile --- you have to state explicitly
> where the home directory lives.

Nope, you can also use expand_path as I learned a couple of months ago
:-)

Martin.
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Earth&Planetary Sciences, Harvard University
186 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA

phone: (617)-496-8318
fax : (617)-495-4551

e-mail: mgs@io.harvard.edu
IDL-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/
------------------------------------------------------------ -------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: off the box and already in trouble
Next Topic: Log Plot with Object Graphics

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

Current Time: Wed Oct 08 15:33:12 PDT 2025

Total time taken to generate the page: 0.00595 seconds