@echo off
set Lst=List.txt
set SavDir=D:\指定目录
set SrcDir=D:\test1,F:\test2,E:\test3
for /f "delims=" %%a in (%Lst%) do (
for %%i in (%SrcDir%) do (
for /f "delims=" %%y in ('dir /ad /s /b "%%~i\*%%~a*"') do (
xcopy /s /e /h "%%~y" "%SavDir%\%%~nxy\"
)
)
)
pause
@echo off&setlocal enabledelayedexpansion
set "folder=指定目录"
for /f %%a in ('dir /ad /b /s ^|findstr /L /G:list.txt') do (
echo "%%a"
set /p answer="你是否要复制上面的文件夹到:%folder% (Y/N)"
if /i "!answer!"=="Y" (
set "target=%folder%\%%~nxa"
mkdir "!target!"
xcopy /s /e /i "%%~a" "!target!"
)
)
pause