thexder1
12 years agoContributor
Using jscript to delete a directory and all contents
Below is code that I am trying to use to remove directories and all contents, but each time it runs the if statements work, but the DeleteFolder statements give me a path not found error.
function removeDirectories(clientDirectory, processExportDirectory, extractExportDirectory) {
var fso = new ActiveXObject("Scripting.FileSystemObject");
if (fso.folderExists(clientDirectory)) {
fso.DeleteFolder(clientDirectory);
}
if (fso.folderExists(processExportDirectory)) {
fso.DeleteFolder(processExportDirectory);
}
if (fso.folderExists(extractExportDirectory)) {
fso.DeleteFolder(extractExportDirectory);
}
}