How to delete a very long filename

  • Thread starter Thread starter Boatguy
  • Start date Start date
B

Boatguy

Somehow when I created a folder, it created a folder within a folder within
a folder, ad nauseum, all with the same name. See below in ( ). I am unable
to delete this (these) folders because of a long file name. I cannot copy,
edit, rename or move any of the files in the last folder. I don't know how
this happened, everything else is normal.
Here is the file name. ( D:\VIP\08 022\08 022\08 022\08 022\08 022\08 022\08
022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08
022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08
022\08 022\08 022\08 022\08 022\PI)

Is there someway to delete this folder?
Boatguy
 
Boatguy said:
Somehow when I created a folder, it created a folder within a folder within
a folder, ad nauseum, all with the same name. See below in ( ). I am unable
to delete this (these) folders because of a long file name. I cannot copy,
edit, rename or move any of the files in the last folder. I don't know how
this happened, everything else is normal.
Here is the file name. ( D:\VIP\08 022\08 022\08 022\08 022\08 022\08 022\08
022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08
022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08 022\08
022\08 022\08 022\08 022\08 022\PI)

Is there someway to delete this folder?
Boatguy

The simple way
rd /s /q "D:\VIP\08 022"
won't work because the path is too long.

Hence you need to rename all of the "08 022" folders
with a little batch file:
CD /D D:\VIP
:Loop
if not exist "08 022" goto :EOF
rename "08 022" 8
cd 8
goto :Loop

Now you can do something like
rd /s /q D:\VIP\8
 
Rename did it.Thankew!!
Boatguy
Rob Stow said:
The simple way
rd /s /q "D:\VIP\08 022"
won't work because the path is too long.

Hence you need to rename all of the "08 022" folders
with a little batch file:
CD /D D:\VIP
:Loop
if not exist "08 022" goto :EOF
rename "08 022" 8
cd 8
goto :Loop

Now you can do something like
rd /s /q D:\VIP\8
 
Back
Top