javascript _ folder exists and create


    Dec 08 2014 | 6:21 pm
    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

    • Dec 08 2014 | 6:39 pm
      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();
      }
      
      
    • Dec 08 2014 | 7:17 pm
      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);
      	}
      }
      
    • Dec 08 2014 | 7:28 pm
      cool