Directories
Use the fs
("filesystem") module to make, read, check, remove directories.
main.w
bring fs;
// Make directory
fs.mkdir("subdir");
// Check if path is directory
fs.isDir("subdir");
// Set permissions on directory
fs.setPermissions("subdir", "0755");
// Try and parse
if let dirTryFrom = fs.tryReaddir("random-folder") {
log("Directory is there");
} else {
log("No directory found");
}
// Remove a directory
fs.remove("subdir");
Wing console output
# Run locally with wing console
No directory found