Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete a long path in windows.

When importing a project into eclipse, it somehow started creating recursive versions of the directory.

Now, when I try to delete anything, I get the message " the file name you specify is too long."

I can't delete it from the command shell. I can't delete it from explorer. I can't do ANYTHING with it. I have no idea how many copies of it Eclipse created. Eclipse was running for like a minute before I realized something was wrong and I cancelled the operation.

I can get the properties of the top level folder, and it says it contains 497 folders.

Question 1: how can I delete all this stuff in Windows?

Question 2: What the hell was eclipse thinking?

like image 943
Baltimark Avatar asked Feb 15 '09 15:02

Baltimark


People also ask

How do you delete a path too long?

For those who are unable to use this solution I have an alternative solution that worked for me (with too long path/file names): Move the file(s)/directory to C:\ to shorten the path, then delete from there. It is possible to have directories that this solution won't work for, that 7-Zip can delete.

Can't delete path is too long?

If the path is too long and not just the filename itself, you can easily just rename the folders to make the path shorter. But to delete a file whose name is more than 255 characters: Open a command prompt by running "CMD.

How do I delete a long file name in Windows 10?

Thanks for your help. Go to File Explorer, locate and select the files/folders, hold down the shift key and hit the Delete key. That removes them completely and they do not go into the recycle bin.

How do I shorten a long file path?

The general strategy is to keep the first two folders at the beginning, replace the middle with an ellipsis, and leave the final folder and filename on the end.


2 Answers

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.

like image 170
gonsalu Avatar answered Oct 02 '22 13:10

gonsalu


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!

like image 29
Swanidhi Avatar answered Oct 02 '22 13:10

Swanidhi