I regularly suffer from this annoying Windows treat: being unable to delete files that are located in a path which name is too long. Specifically, this occurs on files created by Node.js. Maybe that might be the reason. But it’s still illogical, since the file was allowed to be written by the OS in the first place.
An example: C:\SourceTree\dso\node_modules\grunt-spritesmith\node_modules\spritesmith\node_modules\pixelsmith\node_modules\get-pixels\node_modules\ndarray-pack\node_modules\cwise-compiler\node_modules\uniq\test
You would want to do that if you want to ‘clean’ your npm install folder, for example.
With tips and tricks suggested on support forums, -at least in my case- I was unable to delete this file/folder. Nothing will work, not even an Adminstrator PowerShell console.
The only solution ? 7-Zip. Yep, that’s right, the popular compression tool. When you do Shift-Del (bypassing the Recycle Bin), it actually uses it’s own internal file engine to delete the files, instead of hooking into the operating system. As a bonus, it deletes the files faster as well.
How ? Simply open the 7-Zip File Manager, and navigate to the big bad folder (containing the files) in question. Select what you want to see gone, and press Shift-Del. Done and done.