Windows sometimes can't delete files and folders because the path and name are longer than the allowed 255 characters.

Ways to delete undeletable files and folders

  1. Try shift-delete in Windows Explorer.
    This should normally bypass moving the file or folder to the trash bin.

  2. Try deleting the file or folder from the command line.
    c:\ > del toolongfilename.txt


  3. Try deleting the file or folder from the Powershell command line.
    PS c:\ > remove-item toolongfilename.txt


  4. Try moving the file to a folder higher up in the folder hierarchy, thus shortening the path/name.

  5. Use the file manager in eg 7zip to delete the file or folder.
    Download it from https://www.7-zip.org.

  6. Use robocopy to delete the files or folders. Robocopy is preinstalled in all Windows-versions since Vista or so.
    Be careful though, files and folders will not go to the trash bin and will not be available for recovery!
    The basic idea with using robocopy is to sync a new empty folder to the folder containing the pesky files with too long names.
    Using the command line:

    c:\ > dir
    Directory of c:\delete\this\folder\with\a\very\long\name
    Loremipsumdolorsitamet,consecteturadipiscingelit.Phaselluseget.Loremipsumdolorsitamet,consecteturadipiscingelit.Phaselluseget.Loremipsumdolorsitamet,consecteturadipiscingelit.Phaselluseget.txt

    c:\ > md c:\emtpynewfolder

    c:\ > robocopy c:\emtpynewfolder c:\delete\this\folder\with\a\very\long\name\Loremipsumdolorsitamet,consecteturadipiscingelit.Phaselluseget.Loremipsumdolorsitamet,consecteturadipiscingelit.Phaselluseget.Loremipsumdolorsitamet,consecteturadipiscingelit.Phaselluseget.txt /purge

    c:\ > rd c:\emtpynewfolder


The tricks and hints above have have been collected from several sources over the years.