How to delete a long path in windows. How to delete a long path in windows. windows windows

How to delete a long path in windows.


robocopy empty_dir base_nested_dir /purge

Example: If you have a folder path that's too long such as:

D:\BackupFolder\Copy\MyFiles\BackupFolder\Copy\MyFiles\BackupFolder\Copy\MyFiles\BackupFolder\Copy\MyFiles\BackupFolder\Copy\MyFiles\BackupFolder\Copy\MyFiles\BackupFolder\Copy\MyFiles\BackupFolder\Copy\MyFiles\BackupFolder\Copy\MyFiles\BackupFolder\Copy\MyFiles\BackupFolder\Copy\MyFiles\BackupFolder\Copy\MyFiles\BackupFolder\Copy\MyFiles

follow these instructions to delete it.

  1. Create an empty folder, such as C:\Users\Name\Desktop\temp.
  2. Open a Command Prompt window.
  3. Type robocopy C:\Users\Name\Desktop\temp D:\BackupFolder /purge

Note: If there are spaces in either path in Step 3, the path must be inclosed by quotation marks.


7Zip is the ultimate solution if you are not comfortable with command-line.

  1. Open 7Zip File Manager
  2. Navigate to your file
  3. Shift-Delete your file

Cheers!


I had a problem similar to this with Eclipse: trying to import a project using Subclipse, it generated a deeply nested set of directories which I couldn't delete.

I did a couple of things, firstly I edited the directory names down to the shortest length possible (actually I think this was pointless). Secondly, I traversed the directory tree as deeply as possible and then cut and pasted the branch out (which makes it possible to delete the original branch), and then repeated the process.

@Charlie and @Tomalek's solutions look like they might be more elegant. I don't plan on repeating the experience to find out though.