开发者

How to iterate and Check for existence of files in directories MS-DOS

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" & @xcop开发者_高级运维y %%c %send1% /Y /I /S))
pause

Where am I going wrong?


Would you believe you were one character off? x in %%~nxc stands for the extension (.pdf).

FOR /r %base1% %%c in (*.pdf) DO (if not exist %send1%\%%~nxc (echo "Did not exist" & @xcopy %%c %send1% /Y /I /S))

Hope that works for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜