- 帖子
- 7
- 积分
- 12
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2011-5-30
|
本帖最后由 testss 于 2012-2-14 11:19 编辑
我的代码
set inpath=D:\aaa
set existingfiles=0
set pendingfiles=0
for /f %%i in ('dir /a-d /b %inpath%\*') do (set /a existingfiles+=1)
if %existingfiles% lss 10 (
for /f %%j in ('dir /a-d /Od /b %inpath%\pending\*.txt') do (
set /a pendingfiles+=1
if %existingfiles%+%pendingfiles% gtr 10 (exit)
)
)
其实我想要的最终结果是:
检查某一目录a下的所有文件,如果文件个数小于10
例如文件个数为3
则到另一目录b下复制文件到a目录,当a目录文件个数大于10, 则退出 |
|