Skip to content

Instantly share code, notes, and snippets.

@FlorianWolters
Created February 20, 2012 22:22
Show Gist options
  • Save FlorianWolters/1871911 to your computer and use it in GitHub Desktop.
Save FlorianWolters/1871911 to your computer and use it in GitHub Desktop.
Removes the directories "System Volume Information" and "$RECYCLE.BIN" from the drive with the specified drive letter.
@ECHO OFF
REM Removes the directories "System Volume Information" and "$RECYCLE.BIN" from
REM the drive with the specified drive letter.
REM
REM Author: Florian Wolters <[email protected]>
REM Link..: http://github.com/FlorianWolters
REM
REM Copyright (C) 2012 by Florian Wolters. All rights reserved.
REM
REM This program is free software: you can redistribute it and/or modify it
REM under the terms of the GNU Lesser General Public License as published by the
REM Free Software Foundation, either version 3 of the License, or (at your
REM option) any later version.
REM
REM This program is distributed in the hope that it will be useful, but WITHOUT
REM ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
REM FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
REM for more details.
REM
REM You should have received a copy of the GNU Lesser General Public License
REM along with this program. If not, see http://gnu.org/licenses/lgpl.txt.
SETLOCAL
SET /P DRIVE_LETTER=Drive letter:
SET FOLDERNAME_SVI=System Volume Information
SET FOLDERPATH_SVI=%DRIVE_LETTER%:\%FOLDERNAME_SVI%
SET FOLDERPATH_RECYCLER=%DRIVE_LETTER%:\$RECYCLE.BIN
ICACLS "%FOLDERPATH_SVI%" /grant[:r] "%USERNAME%":(F) /T /C /Q
RD /S /Q "%FOLDERPATH_SVI%"
RD /S /Q "%FOLDERPATH_RECYCLER%"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment