如何迭代并检查 MS-DOS 目录中文件是否存在
我希望能够迭代目录中的所有文件。对于我迭代的每个文件,我想检查该文件是否存在于另一个目录中。然而我尝试的一切都失败了。截至目前我有以下代码。
set base1="c:\documents and settings\pp57542\My Documents\Oracle Readings"
set send1="L:\Documents\Expert Book\Expert Book"
title Backup Script for Startup Routine Step 1
FOR /r %base1% %%c in (*.pdf) DO (if not exist %send1%\%%~nc (echo "Did not exist" & @xcopy %%c %send1% /Y /I /S))
pause
我哪里错了?
I would like to be able to itereate through all files in a directory. For each file I iterate over I would like to check to see if that file exists in another directory. However everything I try fails. As of right now I have the following code.
set base1="c:\documents and settings\pp57542\My Documents\Oracle Readings"
set send1="L:\Documents\Expert Book\Expert Book"
title Backup Script for Startup Routine Step 1
FOR /r %base1% %%c in (*.pdf) DO (if not exist %send1%\%%~nc (echo "Did not exist" & @xcopy %%c %send1% /Y /I /S))
pause
Where am I going wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你相信你是一个角色吗?
%%~nxc
中的x
代表扩展名 (.pdf)。希望这对你有用。
Would you believe you were one character off?
x
in%%~nxc
stands for the extension (.pdf).Hope that works for you.