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

Home » Public Forums » archive » Re: cd to nonexistent directory and up again
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: cd to nonexistent directory and up again [message #81704 is a reply to message #81703] Tue, 16 October 2012 05:55 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
On 10/16/12 06:33, tom.grydeland@gmail.com wrote:
> Why is it that this fails:
>
>
> IDL> cd, 'bobo/..' % CD: Unable to change current directory to
> bobo/... No such file or directory
>
> but this does not:
>
> IDL> cd, './bobo/..' IDL>
>
>
> I am using CD to determine whether a given path exists as a
> directory, and I was expecting the second case to fail just like the
> first one does, since there is no difference between them in my
> mind.

This is (slightly) tangential...

Why not use "FILE_SEARCH" to determine path existence? E.g. from one of
my procedures:

dir_list = FILE_SEARCH("Example*", COUNT=n_dirs)
IF ( n_dirs EQ 0 ) THEN $
MESSAGE, 'No "Example*" directories found!'

And, if the possibility of files being confused for directories is
likely, you can then use the FILE_INFO() function to determine which
elements of the above "dir_list" are actual directories, e.g.

IDL> dir_list = FILE_SEARCH("*", COUNT=n_dirs)
IDL> dir_info = FILE_INFO(dir_list)
IDL> help, dir_info.directory
<Expression> BYTE = Array[11]
IDL> print, dir_info.directory
1 1 1 1 1 1 1 1 1 0 0

First 9 entries in "dir_list" are directories, last two are not.

cheers,

paulv
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: About duration of run process
Next Topic: Re: Surface/shade_surf problem on IDL 7.1 / Lion OS ??

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

Current Time: Fri Oct 10 09:01:13 PDT 2025

Total time taken to generate the page: 0.88357 seconds