Home > System Administration > Cannot Delete: Path Too Long

Cannot Delete: Path Too Long

December 13th, 2007 James Hawes

Just now I ran into a problem with an installation of a product which had very deep folder structures. I had to uninstall and delete the folders and files in order to do a fresh install. When I attempted to delete the files through Explorer and the cmd prompt I was being told that either the path was too long or the file name was too long.

Perhaps I’ve been doing development too long because I could not remember for the life of me how to get around this problem. After a few quick searches I was reminded of the the syntax “\\.\” and this solved my problem. I wanted to remove everything from the root folder of the application.

To remove folders and files:

ex. rd “\\.\c:\Path to long directory” /s /q

To removefiles

ex. del “\\.\c:\Path to file”

Give credit where credit is due:

  1. My good friend Jeremy Simmons
  2. Microsoft Support
  3. Where my memory was jogged: IT News Group.NET which is simply an alias to: microsoft.public.windows.server.general
Categories: System Administration Tags:
Comments are closed.