- @echo off
- setlocal enabledelayedexpansion
- set "srcFolder=D:\Test"
- set "dstFolder=E:\Test"
- set "thisMonth=%date:~0,7%"
- for /d %%i in ("%srcFolder%\r_*") do (
- set folderName=%%~ni
- set folderType=!folderName:~2,1!
- if "!folderType!" equ "g" (
- if not exist "%dstFolder%\水数据\%thisMonth%\!folderName!" (
- md "%dstFolder%\水数据\%thisMonth%\!folderName!"
- )
- move /y "%%i\*.txt" "%dstFolder%\水数据\%thisMonth%\!folderName!"
- ) else if "!folderType!" equ "w" (
- if not exist "%dstFolder%\气数据\%thisMonth%\!folderName!" (
- md "%dstFolder%\气数据\%thisMonth%\!folderName!"
- )
- move /y "%%i\*.txt" "%dstFolder%\气数据\%thisMonth%\!folderName!"
- )
- )
复制代码
|