# Page 186 why git rm can not delete JS folder

**URL:** <https://forums.kodeco.com/t/page-186-why-git-rm-can-not-delete-js-folder/127491>\
**Category:** Advanced Git\
**Created:** [December 14, 2020, 3:48am UTC](https://forums.kodeco.com/t/page-186-why-git-rm-can-not-delete-js-folder/127491 "2020-12-14T03:48:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yangwulong1978](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/yangwulong1978/32/102075_2.png) [@yangwulong1978](https://forums.kodeco.com/u/yangwulong1978)\
**Post date:** [December 14, 2020, 3:48am UTC](https://forums.kodeco.com/t/page-186-why-git-rm-can-not-delete-js-folder/127491/1 "2020-12-14T03:48:27Z")

</div>

in your page 186, git rm -r js to remove js folder.

when I excute this command, it will delete files and sub directory under JS.

but folder JS itself still there, just become empty directory.

I tried other chapter’s magicSquareJS folder to git rm -r js to remove js folder.

some can remove entire JS folder, some still left empty JS foldler there.

weird , dont know why behavior like this.

---

<div class="post-metadata">

**Author:** ![gdelarosa](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/gdelarosa/32/109063_2.png) [@gdelarosa](https://forums.kodeco.com/u/gdelarosa)\
**Post date:** [December 16, 2020, 3:23pm UTC](https://forums.kodeco.com/t/page-186-why-git-rm-can-not-delete-js-folder/127491/2 "2020-12-16T15:23:13Z")

</div>

Hi @yangwulong1978, this is something I’ve come across before and I’m ultimately not sure why this occurs. My best guess from what I’ve read online is it has something to do with git not tracking folders/directories only paths. I apologize in advance for not knowing more information about this but maybe someone who sees this can chime in.

Best,  
Gina

---

<div class="post-metadata">

**Author:** ![jawwad](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jawwad/32/108543_2.png) [@jawwad](https://forums.kodeco.com/u/jawwad)\
**Post date:** [September 17, 2021, 1:46am UTC](https://forums.kodeco.com/t/page-186-why-git-rm-can-not-delete-js-folder/127491/3 "2021-09-17T01:46:51Z")

</div>

Hi @yangwulong1978,

Yes, @gdelarosa guess is correct that this has to do with git not tracking folders and only paths.

So what happens is that if there are any ignored files, (likely .DS\_Store), git rm won’t delete the folder. But if you remove the .DS\_Store file first and then run the `git rm` command it will actually remove the folder as well.

The second edition of the book will just recommend running `rm -rf js` to avoid the confuses this causes.

Thanks,  
Jawwad
