Calling Windows Command

Vino vino.bheeman at hotmail.com
Wed Mar 21 18:50:38 UTC 2018


Hi All,

  Request your help in calling the windows command to delete all 
file and folders recursively as the D function rmdirRecurse does 
not delete file in the permission of the file is readonly in 
windows 2008 R2

import std.process: execute;
import std.array: empty;
auto RemoveDir () (
auto dFiles = "C:\\Temp\Test1";
auto Step = "run";
if (Step == "run" && !dFiles.empty) {
     version(Windows)
      {
       foreach(d; dFiles) {
       execute(["rmdir.exe","-command", "/S /Q", `~d~`]); } } } 
return dFiles;
)

void main () {
writeln(RemoveDir);
}

From,
Vino.N


More information about the Digitalmars-d-learn mailing list