[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mkdir?

"Christopher W. O'Dell" wrote:
> Is there anyway to create a directory in your OS from within
> IDL?
> I keep running into problems using the SAVE function, when I
> have forgotten to create the directory to which I am
> saving.  I just want to add a line of code that checks if
> the directory exists, and if it doesn't it makes the
> directory.
> BTW, I'm running on a Windows platform (your are welcome to
> make fun of me at this point...)
> Thanks,
> Chris O'Dell
> UW-Madison Physics Dept.

Here is what I do under Unix in IDL 5.1:

   dir = '/the/directory/im/looking/for/'

   ; Create the directory, if necessary.
   check = findfile( dir, count=direxists )
   if (direxists eq 0) then spawn, 'mkdir '+dir

I am sure something equivalent can be done in Windows.