how can I expand on the following batch code so that everything in the Tim folder is checked against all folders in the Tom directory.
Beter said if Tim has a file named Mytext.txt in it how can I check all and not just the top directory fond starting with C:\Tom, it may be that in tom there is a another folder with an other folder in that yet again with Mytext.txt in it.
All the code below currently dose is check the specifide directory only i would also like to check through any subdirectorys?
for /r "C:\Tim" %%f in (*) do if开发者_运维知识库 exist "C:\Tom\%%~nxf" del /s /q "C:\Tim\%%~nxf"
You nearly got it, you only need a second FOR /R
loop, to search in all subdirs of TOM
for /r "c:\tim" %%I in (*) do (
echo searching for %%~nxI
for /r "C:\tom" %%O in (%%~nxI) do (
if exist %%O echo found in %%O
)
)
精彩评论