Created
March 10, 2015 01:05
Windowsバッチ 文字列検索し、コピー&削除
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 "結果ファイルの出力" | |
rm -f result.txt | |
findstr /S /M "検索文言" *.txt >> result.txt | |
ECHO "backupフォルダのクリーン" | |
rmdir /S /Q backup | |
mkdir backup | |
ECHO "結果ファイルを使ってxcopy" | |
for /f "tokens=1* delims=: eol=" %%X in ('findstr /n "^" result.txt') do ( | |
echo F | xcopy %%Y backup\%%Y /I /R /Y | |
) | |
ECHO "結果ファイルを使ってrm" | |
for /f "tokens=1* delims=: eol=" %%X in ('findstr /n "^" result.txt') do ( | |
rm -f %%Y | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment