且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

批处理 - 基于最后2个字符的文件夹复制

更新时间:2023-02-04 23:01:38

 为/ D %% f由于(%temp%\\ * 14)做(
    MDC:\\地方\\ %%〜NXF> NUL 2 - ; NUL
    XCOPY%%〜FFC:\\地方\\ %%〜NXF/ E / Y

I've searched the web and can not find solution or I can not adapt them to my problem. I would like for batch to copy subfolders from folder TEMP (few thousand subfolders) only if last two characters of any subfolder are 14.

for /d %%f in ("%temp%\*14") do (
    md "c:\somewhere\%%~nxf" > nul 2>nul 
    xcopy "%%~ff" "c:\somewhere\%%~nxf" /e /y
)