When you attempt to delete a folder and receive PATH TOO LONG, you would normally
Use the 8.3 short name, unless it has been disabled.
Type dir /x <full path to file>. If the 8.3 path is too long, start renaming parent folders
until the path is short enough.
I have scripted DelFolder.bat to delete a folder, even if the path is too long.
The syntax for using DelFolder.bat is:
DelFolder FolderPath
Where FolderPath is the path to the folder you wish to delete.
NOTE: DelFolder.bat uses RoboCopy.exe, which must be located in a folder that is in your PATH.
DelFolder.bat contains:
@echo off if \{%1\}==\{\} @echo Syntax: DelFolder FolderPath&goto :EOF if not exist %1 @echo Syntax: DelFolder FolderPath - %1 NOT found.&goto :EOF setlocal set folder=%1 set MT="%TEMP%\DelFolder_%RANDOM%" MD %MT% RoboCopy %MT% %folder% /MIR RD /S /Q %MT% RD /S /Q %folder% endlocal
16 comments
Hide comments