Pages

Saturday, November 02, 2013

Delete File Paths that are "Too Long"

It's bound to happen sooner or later. You go to delete a directory and instead get an error message to the effect of "I'm sorry, this file path is far too long so you can't do anything with it."

One way to overcome this is to use robocopy, a command line tool that comes standard in any modern version of Windows.


  1. Open a command prompt (Start->Run->cmd)
  2. Navigate to the parent of the directory you want to delete (cd [path])
    e.g. if you want to delete C:\dev\example\toolongdirroot\, navigate to C:\dev\example\
  3. Make an empty directory (mkdir .\emptydir)
  4. Use robocopy to mirror the empty directory to the toolongdirroot (robocopy .\emptydir .\toolongdir /mir)
  5. Congratulations, you did it! Delete emptydir and toolongdir and you're done!


No comments: