![](/img/trans.png)
[英]Copy file from folder if not exist in a different folder with batch file
[英]batch file to check if the specific word “test” exist in the files, IF exist copy the whole folder to another location
如何檢查文件夾內的任何文件(包含大量文件夾和文件)中是否存在“test”一詞。如果存在,請將整個文件夾復制到另一個位置。
請幫忙謝謝
findstr /c:"test" *.txt > NUL
if not errorlevel 1 xcopy *.* anotherlocation
如果要在任何級別檢查當前文件夾下的所有文件,請在 findstr 命令中添加 /S 開關。 在 xcopy 命令中執行相同的操作以復制整個文件夾結構。
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
findstr /c:"Finished schedule" E:\Init.log > NUL
if "!errorlevel!"=="0"
( echo "OK" )
else ( echo "NOK" )
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.