Skip to content

Instantly share code, notes, and snippets.

@taverasmisael
Created October 6, 2015 01:49
Show Gist options
  • Save taverasmisael/6b9bd6b01c4840d812c0 to your computer and use it in GitHub Desktop.
Save taverasmisael/6b9bd6b01c4840d812c0 to your computer and use it in GitHub Desktop.
This simple "bat" script will help windows user to delete folders with large path, with "Robocopy" help. For example delete node_modules folder
@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