如何选择第二,第三,第四...最新的文件夹与批处理 [英] How to select the second, third, fourth.... newest folder with batch

查看:50
本文介绍了如何选择第二,第三,第四...最新的文件夹与批处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个批处理程序,它检查最新文件夹中的.xml文件并将它们复制到另一个文件夹,在复制文件后,它应该调用应用程序并停止.现在,我需要让批处理监视下一个文件夹(在第一个文件夹中完成整个循环之后)是否有任何.xml文件,并执行相同的操作,依此类推……使用此代码,我可以复制所有.xml文件从最新文件夹到另一个文件夹:

I have written a batch which checks the newest folder for .xml files and copy them to another folder, after copying the files it should call an application and stop. Now I need to let the batch watch in the next folder (after completing the whole circle with the first) for any .xml files and do the same, and so on... With this code I can copy all the .xml files from the newest folder to another folder:

SETLOCAL
SET "sourcedir=Y:\PriCat\Debiteuren"
SET "destindir=Y:\Pricat\Pricatombouw"
set source="Y:\Pricat\Pricatombouw"
set target="Y:\Pricat\XMLOmbouw\nieuw"
set var1=0



FOR /f "delims=" %%a IN (
  'dir /b /ad /o-d "%sourcedir%\*" '
  ) DO XCopy /y /s "%sourcedir%\%%a\*.xml" "%destindir%\" &GOTO done
:done

推荐答案

只需从代码中删除&GOTO done.之后,:done也将无用,因此您也可以删除最后一行.

Just remove &GOTO done from your code. Afterwards :done will be useless as well so you can remove the last line, too.

这篇关于如何选择第二,第三,第四...最新的文件夹与批处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆