isFolder()

Function to check whether an object is a Folder object and whether the folder exists.

The function isFolder() is located in the file folder.jsxinc.

Usage

To check whether the variable is a folder object.

var folder = new Folder("C:/myfolder");
if(isFolder(folder))
  //Do something if this is a folder.

To check wether the variable is a folder object and to check that the folder exists.

var folder = new Folder("C:/myfolder");
if(isFolder(folder, true))
  //Do something if this is a folder and when this folder exists.

Parameters

Parameter Data type Required Description
folder All The object or variable you want to check.
mustexist Boolean   If set to true the function only returns true when the folder exists on the file system. Default is false.

Return values

Value Meaning
true The specified object is a Folder object. When the second parameter is set to true, this also means that the folder exists on the file system.
false The specified object is not a Folder object. When the second parameter is set to true, this can also mean that the folder does not exist on the file system even when the object is a Folder object.