3

I am trying to port a Makefile to Windows (using GNU Make). I am having trouble with removing directories. I found this question (Delete a directory and its files using command line but don't throw error if it doesn't exist) on how to conditionally remove directories, but I get an error trying to use that solution, translating approximately to The use of ""doc\html"" is syntactically impermissible in this context

The snippet causing it is this:

if exists "doc\html\" rmdir /Q /S doc\html

I also tried

cmd /c if exists "doc\html" cmd /c rmdir /Q /S doc\html

and

cmd /c if exists "doc\html\" cmd /c rmdir /Q /S doc\html.

I also tried rmdir /Q /S doc\html 2>nul. That works kind of. The error gets redirected, but Make still throws an error and stops.

How can I make this work?

Community
  • 1
  • 1
lo tolmencre
  • 3,804
  • 3
  • 30
  • 60

1 Answers1

7

the command is exist not exists. There is a typo in the thread I linked...

lo tolmencre
  • 3,804
  • 3
  • 30
  • 60