I have a root folder "Basic" which has child folders "1", "2" and "3". "1" has sub-folders "11", "12" and "text.txt". Similarly "2" has sub-folders "22", "21" and "text.txt". "3" has "31" and "32".
I need a batch file program to find whether "text.txt" is present in each folder. If it isn't present in a particular root folder "Basic", I want to write the child folder's name in missingfile.txt.
Here is my account - It doesn't work.
set value = ""
set exact = ""
cd "C:\Users\bthirumurthy\Desktop\Basic"
dir "C:\Users\bthirumurthy\Desktop\Basic" /b >> text.txt
for %%a in (text.txt) do (
if (%%a|="text.txt") (
dir C:\Users\bthirumurthy\Desktop\Basic\%%a /b >> C:\Users\bthirumurthy\Desktop\Basic\%%a\result.txt
for %%b in (result.txt) do (
if(%%b == "text.txt") (
set exact = %%b
set status = 1
)
else (
set missingfile =%%b
set status = 0
)
)
if (%status% == 1) (
echo %exact% pass >> pass.txt
)
else (
echo %exact% fail >> Missingfile.txt
)
set status = ""
)
)>>output.txt
Can you please help me out?