javascript _ folder exists and create

Spa's icon

I know the script for testing if file exists (file.isopen)
It does not work with folders.
Is there an equivalent of Java 'import java.io.*' in max6 or max7?
I want to keep it in javascript cos it's part of a bigger db scripting
Thanks

do.while's icon

there is Folder object in JS with which u can scan specified location for files . U can retrieve names of files and folders , paths , sizes .etc .
You can restrict it to scan for folders only too .

var fold = new Folder("c:");
fold.typelist = ["fold"] ;
while(!fold.end){
    post(fold.filename,"\n");
    fold.next();
}

Spa's icon

Strictly for testing if the folder exists. No iteration through files...

function folderExists(file){
    var fold = new Folder(file);
    if (fold.end) {    
        return (false);
    }
    else {
    return (true);
    }
}
do.while's icon