Any of the following should work for you:

if ( -e $dirpath && -d $dirpath ) { ...stuff...}
if ( -e $dirpath && -d _ ) { ...stuff...}
if ( -d $dirpath ) { ...stuff...}

You can always substitute $dirpath for a literal string path in the above
as well...e.g.:

if ( -d '/usr/bin/home' ) { ... stuff ... }

The -e test checks to see that $dirpath exists, -d checks that it is a
directory.  The underscore means "whatever the last filetest operated on,
operate on that same thing".  Read more about it here:

        http://www.perldoc.com/perl5.6/pod/func/X.html

Dave S


On Wed, 21 Nov 2001 [EMAIL PROTECTED] wrote:

> what is the best way to check for the existence of a directory?
> (windows/Linux)
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to