Created
June 6, 2014 23:42
-
-
Save purplecabbage/7c380396c3db19b58014 to your computer and use it in GitHub Desktop.
Delete deeply nested folder in windows when path is too long
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM Solution is posted here, saving this if this ever happens to me again. | |
REM http://windowsitpro.com/windows/jsi-tip-9651-how-can-i-delete-folder-returns-path-too-long | |
@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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment