This is what I tried:
package main
import (
"fmt"
"os/exec"
)
func main() {
fmt.Println("Removing build directory")
if err := exec.Command("cmd", "/S /Q", "RD", "c:\\build").Run(); err != nil {
fmt.Printf("Error removing build directory: %s
", err)
}
if err := exec.Command("cmd", "/C", "mkdir", "c:\\build").Run(); err != nil {
fmt.Printf("Error making new build directory: %s
", err)
}
}
And my output is:
Removing build directory
Error making new build directory: exit status 1
So I don't get any error when removing, but it doesn't delete anything.
Why is that ?