Last active
July 7, 2019 04:38
-
-
Save fengye/c2726b5219a83e538047b752baa1b707 to your computer and use it in GitHub Desktop.
Take ownership and assign permission then remove all the files recursively in one folder
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
@echo off | |
setlocal | |
:PROMPT | |
@echo DELETING %1 !!! | |
SET /P AREYOUSURE=Are you sure (Y/[N])? | |
IF /I "%AREYOUSURE%" NEQ "Y" GOTO END | |
takeown /f %1 /r /d y | |
icacls %1 /grant Everyone:(OI)(CI)F /T | |
icacls %1 /grant %username%:F /T | |
rmdir /Q /S %1 | |
:END | |
endlocal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment