回复 1# PCL0769 - @echo off
- set "SrcFolder=D:\数据\周转"
- set "DstFolder=D:\数据\合并"
- if not exist "%SrcFolder%" (
- goto :eof
- )
- if not exist "%DstFolder%" (
- md "%DstFolder%"
- )
- for /f "delims=" %%i in ('dir /b /ad "%SrcFolder%"') do (
- for /f "delims=" %%j in ('dir /b /a-d "%SrcFolder%\%%i\*.txt" 2^>nul') do (
- >"%DstFolder%\%%j" type "%SrcFolder%\%%i\%%j"
- for /f "delims=" %%k in ('dir /b /ad "%SrcFolder%" ^| findstr /v /b /e "%%i"') do (
- if exist "%SrcFolder%\%%k\%%j" (
- >>"%DstFolder%\%%j" type "%SrcFolder%\%%k\%%j"
- )
- )
- >>"%DstFolder%\%%j" echo,
- )
- goto :eof
- )
复制代码
|