Created
February 9, 2017 11:38
-
-
Save toagit/71b85c29015447ea1a4244b4e5462057 to your computer and use it in GitHub Desktop.
リストファイルに存在しないフォルダを削除する
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 | |
pushd %0\.. | |
setlocal enabledelayedexpansion | |
set "TARGET_FOLDER=D:\xxxx" | |
for /f "tokens=*" %%a in ('dir %TARGET_FOLDER% /b /a:d') do ( | |
set SHOULD_DEL=true | |
for /f "tokens=1* skip=1" %%i in (include.list) do ( | |
if "%%a"=="%%j" ( | |
echo [DEBUG] -- バックアップ対象:%%j | |
set SHOULD_DEL=false | |
) | |
) | |
if !SHOULD_DEL!==true ( | |
echo rd "%TARGET_FOLDER%\%%a" /q/s | |
echo [INFO] -- %TARGET_FOLDER%\%%aを削除しました。 | |
) | |
) | |
pause |
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
from to | |
from1 to1 | |
from2 to2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment