This language bar is your friend. Select your favorite languages!

Idiom #212 Check if folder exists

Set boolean b to true if path exists on the filesystem and is a directory; false otherwise.

import os
b = os.isdir(path)
import "os"
info, err := os.Stat(path)
b := !os.IsNotExist(err) && info.IsDir()
sysutils
b := DirectoryExists(path);
use 5.010;
my $b = -e -d $path;
b = Dir.exist?( path )

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

programming-idioms.org

Related idioms