When you use NPM in your projects and install some modules, their paths too long. So if you try to delete them, you'll see the following error message:
Th reason why, is that the Windows API, the maximum length for a path is defined as 260 character.
To solve that you can use robocopy:
$ mkdir [empty_tmp_dir]
$ robocopy [dir_to_delete] [empty_tmp_dir] /s /mir
$ rmdir [dir_to_delete] [empty_tmp_dir]
- In the first line we create an empty temporary folder.
- In the second we use robocopy to do the trick for us with the help of the temp folder which we created in the first line.
- In the third line we remove both folders.