Windows – Cannot delete maven target folder in windows 8.1

filesystemsmavenwindows

I have used IntelliJ's maven plugin to build my project with mvn clean install.
It fails on clean due to problems deleting certain folders within the target-directory.

I had this error multiple times and I could always solve it by utilizing unlocker or bash rm -rf <dir>, but not this time.

These are the things I tried to delete the folders:

  1. windows explorer > right-click > delete:

    seems to do nothing, not even output an error

  2. cygwin > bash rm -rf: rm:

    cannot remove 'tiny_mce/plugins/fullscreen': File exists

    rm: cannot remove 'tiny_mce/plugins/iespell': Directory not empty

  3. unlocker > delete:

    unlocker option selection

    error message: could not delete

  4. eclipse/intellij > delete

    Java IOException: cannot delete…

I hope there are other options since I cannot continue my work on my local machine as long as I have this problem. And I certainly do not want to switch my workspace and setup everything from the beginning under a new path. This can't be the solution!

Update:

  1. Moving the folder to another location

    Strangely, it worked. I still cannot delete that folder, but I could continue my work. However, I want it removed…

Best Answer

The answer to my problem was to check my filesystem for damages and repair them.

So I ran chkdsk.exe /x /f /r, confirmed and restarted my system and voilà... I can finally delete that folder.