Force Delete Large Name Files – How to Force Delete Files with a Rather Large Name

filesystemswindowswindows 7

I regularly use Node.js to manage dependencies for programs I write, no big deal. Today I ended up with a folder structure like this: enter image description here

Trying to delete any file was met with this error:

The source file name(s) are larger than is supported by the file
system. Try moving to a location which has a shorter path name, or try
renaming to shorter name(s) before attempting this operation.

It was already in C:\, so it wasn't going to get much shorter.

Best Answer

Use the Microsoft tool robocopy.exe.

  1. Create a new empty folder, e.g. c:\empty
  2. Then copy that empty folder onto the folder which contains the long filenames which you're trying to delete, e.g. c:\myannoyingfolder. Do this like so in the command prompt:

    robocopy /MIR c:\empty c:\myannoyingfolder

Related Question