# UPDATED: Calling rmdir from Makefile not working

**URL:** <https://travis-ci.community/t/updated-calling-rmdir-from-makefile-not-working/1403>\
**Category:** Windows\
**Created:** [December 13, 2018, 9:50am UTC](https://travis-ci.community/t/updated-calling-rmdir-from-makefile-not-working/1403 "2018-12-13T09:50:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![georgeharley](https://avatars.discourse-cdn.com/v4/letter/g/b2d939/32.png) [@georgeharley](https://travis-ci.community/u/georgeharley)\
**Post date:** [December 13, 2018, 9:50am UTC](https://travis-ci.community/t/updated-calling-rmdir-from-makefile-not-working/1403/1 "2018-12-13T09:50:25Z")

</div>

**Update: User error! I missed the line in the description of the Windows environment that stated Git Bash is the shell used o run the builds.** 😊

When building with our Makefile on Windows we use the standard command `rmdir /Q /S` to delete a directory. i.e.

```auto
clean-docs:
	rmdir /Q /S docs

```

This works as expected when the make is run on a real Windows 10 laptop. However, when the make is run in a Travis Windows environment the delete step fails, seemingly because the /Q and /S options are being treated as directories…

```auto
rmdir /Q /S docs
The command "make build test verify-docs" exited with 2.

Done. Your build exited with 1.
rmdir: failed to remove '/Q': No such file or directory
rmdir: failed to remove '/S': No such file or directory
rmdir: failed to remove 'docs': Directory not empty
make: *** [Makefile:85: clean-docs] Error 1

```

Has anyone else seen this behaviour? Is there a known workaround?

Thanks,  
George

---

<div class="post-metadata">

**Author:** ![GirishBhutiya](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/girishbhutiya/32/9159_2.png) [@GirishBhutiya](https://travis-ci.community/u/GirishBhutiya)\
**Post date:** [March 15, 2024, 12:54pm UTC](https://travis-ci.community/t/updated-calling-rmdir-from-makefile-not-working/1403/2 "2024-03-15T12:54:46Z")

</div>

Yes, I am getting the same error. Did you get the solution of it?

---

<div class="post-metadata">

**Author:** ![tanzislam](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/tanzislam/32/2591_2.png) [@tanzislam](https://travis-ci.community/u/tanzislam)\
**Post date:** [August 31, 2024, 9:15am UTC](https://travis-ci.community/t/updated-calling-rmdir-from-makefile-not-working/1403/3 "2024-08-31T09:15:13Z")

</div>

This is because Travis CI uses [Git Bash as the shell in its Windows environment](https://docs.travis-ci.com/user/reference/windows/#git-bash), where `rmdir` is the Unix-style command and not the `cmd.exe` built-in command.

If your makefile expects to use `cmd.exe` as the shell on Windows, you can [`export SHELL=$(realpath $COMSPEC)`](https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html#Choosing-a-Shell-in-DOS-and-Windows) before running `make`.
