The Directory class provides information about directories, including information about what files and subdirectories are contained in a directory.
// test if a directory exists, if it does, list
// the subdirectories in the directory
const dir = "c:\\";
if (!Directory.exists(dir)) {
alert(`'${dir}' doesn't exist.`);
} else {
const dirlist = Directory.getDirectories(dir);
let output = `In '${dir}', there are ${dirlist.length} subdirectories:\n\n`;
for (const subdir of dirlist) {
output += `${subdir}\n`;
}
alert(output);
} True if the directory was successfully created, false otherwise
Calling this method creates the directory specified in the path parameter
True if the directory was successfully deleted, false otherwise
Calling this method deletes the directory specified in the path parameter
True if the specified path exists and is a directory, false otherwise
Calling this method determines whether the path specified in the path parameter exists and is a directory.
An array containing string values which represent the files and directories contained in the directory specified in the path parameter
Calling this method returns all files and subdirectories found in the directory specified by path.
An array containing string values which represent the subdirectories contained in the directory specified in the path parameter
Calling this method returns all subdirectories found in the directory specified by path.
An array containing string values which represent the files contained in the directory specified in the path parameter
Calling this method returns all files found in the directory specified by path. Directories and other special files are not included in the resulting array.