bat自动获取新文件

bat自动获取新文件
记项目中自用copy小工具
取tt中的文件的名字来作为序号拼接新文件夹
第一个for做的是检测

@echo off & title ファイル
color 0a & mode 36,3
setlocal enabledelayedexpansion

call setting.bat
rem チェックファイルパス
set MtrDir=C:\Users\Administrator\Desktop\test_tmp
set NetDir=C:\Users\Administrator
set NET_FOLDER=Desktop
rem set tablename=if_uni_logon 不call 可以取消注释
set fromfile=%tablename%_

:Loop
for /f "tokens=1" %%c in ('dir "%MtrDir%" /b') do (
rem 检测到新文件做的操作 和下边没关系
rem set /a y=1
rem for /f "tokens=1" %%a in ('dir %NetDir%\%NET_FOLDER%\\tt /b') do (
rem set /a ttnum=%%a-1
rem XCOPY %MtrDir%\* %NetDir%\%NET_FOLDER%\%tablename%\ /y/s/e
rem REN "%NetDir%\%NET_FOLDER%\%tablename%\%%c" "%fromfile%!ttnum!.csv"
rem XCOPY "%NetDir%\%NET_FOLDER%\%tablename%\%fromfile%!ttnum!.csv" \\172.16.1.1\%tablename%\!ttnum!\OUTPUT\pgbulckload\ /y
rem del /f /q %MtrDir%\* 
)
)

choice /t 1 /d y /n >nul
goto Loop

你可能感兴趣的:(batch)