Delete Long File Names Windows 7 9,1/10 4647 votes

Earlier this weak I was cleaning up virtual server for another round of torturous (to me) software experiments. I’ve noticed that one of heavy applications claimed to uninstall correctly, but left folders behind. Folders I was unable to delete.

After few attempts and tools like Unlocker failed (sadly I had no access to Total Commander at moment) I tried to simply browse those folders and umpteenth levels deeper I got message that path is too long to navigate.

Erase file with too long file name. By lopdog 18 replies Apr 15, 2011. Hi, I have a file that I cannot delete, rename or move, because Windows says it's name is too long or the path is to long. MAXPATH is 260 characters. The NTFS file system actually supports file paths of up to 32,767 characters. And you can still use 32,767 character long path names by accessing the Unicode (or 'wide') versions of the Windows API functions, and also by prefixing the path with?. MAXPATH was set in stone a very long time ago in the Windows world.

Theory

Microsoft offers extensive knowledge base article “You cannot delete a file or a folder on an NTFS file system volume”. In short it tells you that very long paths are pain to kill so you better look for software that can do that or enjoy intricate operation of remaining folders until path isn’t too long.

I’d prefer to read that they taught Explorer to do perform its file managing duties with at least some kind of effort to not fail miserably.

Practice

Luckily several Google search result lower there was an article with command line script for exactly this issue. Copy/pasting it here won’t be polite (or copyright-friendly) so grab it from there.

What it does

Since article offered no explanation, except mention that it relies on robocopy I decided to look into it. Turns out it uses robocopy in rather clever way.

  1. Takes folder to delete as command line parameter.
  2. Creates empty folder in system temporary folder.
  3. Runs robocopy, instructing it to copy empty folder over target and destroy everything that is absent in former ( /MIR key).

Essentially robocopy is instructed to overwrite target folder tree and files in it with empty directory. And, as I tested, it does an excellent job – without any issues with long path.

Delete Folder With Long File Name Windows 7

Delete Long File Names Windows 7

As usual I must warn that such kind of script can be extremely destructive, use cautiously.

Overall

How to stop lip smacking while recording. It would have never occurred to me to use robocopy in such way. It shows just how powerful modern command line utilities can be, despite seemingly archaic interface paradigm.

Delete All Files Windows 7

Related Posts

Delete Too Long File Names Windows 7

Similar help and support threads
ThreadForum
Common File Dialog Box - Customize Places Bar
How to Customize Common Open File Dialog Box Places Bar in Windows When you save or open a file in an application that uses Windows common dialog box, the Places bar on the left side of the dialog box can help you navigate quicker to a location. This will show you how to customize the..
Tutorials
Residual File Names in Save/Save As Dialog Boxes
With regard to clearing lists of file names in Windows file dialog boxes, Orbital Shark had described the following procedure (from his 01 Nov., '10 post-) https://www.sevenforums.com/general-discussion/121803-how-clear-dialog-box.html : 'If you want to selectively clear the Common Dialog file..
General Discussion
Common Dialog Boxes - Enable or Disable Dropdown List of Recent Files
How to Enable or Disable Common Dialog Boxes Dropdown List of Recent Files The common open file dialog box is the one that opens when you click on File (menu bar), and say either Open, Save, Import, or Export. This will show you how to enable or disable the common open file dialog boxes..
Tutorials
Common Dialog Boxes - Clear Dropdown List of Recent Files History
How to Reset and Clear Common Dialog Boxes Dropdown List of Recent Files History The common open file dialog box is the one that opens when you click on File (menu bar), and say either Open, Save, Import, or Export. This will show you how to reset and clear the list of most recently used..
Tutorials
Dropdown sub-lists keep going left :(
This is very annoying.. :( While there is plenty of room to the right, most sub-lists in my dropdown menus keep placing themselves to the left. And that in a lot of programs where I had no such problem in XP. Is there a way to change their behavior ????
General Discussion