Force delete files with a rather large name

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


okay, let's say you want to delete a tree D:\very\long\path, you don't necessarily need to use any tools such as Robocopy.

  1. Go to the root directory of the drive which contains the directory which you can't delete
  2. Create a directory with a single letter name, eg D:\a
  3. Navigate to inside the directory that you want to delete, in this case D:\very\long\path
  4. Select all (Ctrl+A) and Cut (Ctrl-X)
  5. Navigate to the folder you just created
  6. Paste (Ctrl-V)
  7. Now, move up to the root directory and delete the temp folder, in this case D:\a
  8. Then go back and delete the original directory

You can integrate this functionality into the windows shell. My enhancement to Flo's answer was too long for a comment.

I added a Delete command to the Windows context menu.

enter image description here

The delete.reg file adds registry entries to associate folders with the robodelete.bat batch file.

delete.reg

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Delete]

[HKEY_CLASSES_ROOT\Directory\shell\Delete\command]
"Extended"=""
@="\"D:\\Documents\\robodelete.bat\" \"%1\""

robodelete.bat

mkdir c:\empty
robocopy /MIR c:\empty %1
rmdir %1
rmdir c:\empty

Note: You may need to change the paths in both files as per your preferences.

WARNING: There is no way to undo this command. It does not use the recycle bin and does not ask Y/N to confirm before destroying the folder for good!