Sorry if the question is confusing. Basically, I have a log.txt with a list of directories. Is there a way to loop through the list, and see if any of the directories contain a folder with a specific name. So if the log has :
C:\test1
C:\test2
and we are looking for a folder called "test3" inside any of the directories in the log, then output that it was found.
edit: I am new to batch and kinda mashed other code i found on here to make this, apologies if its a mess.
for /F "tokens=*" %%Z in (%dir1%\log.txt) do (
cd %%Z
for /d /r "%%Z" %%a in (*) do if /i "%%~nxa"=="test3" set "foldername=%%a"
echo "%foldername%"
)
where dir1 is the directory I'm using elsewhere in the code, and test3 is the string I'm looking for in the subfolder name.
I think I need to use SetLocal EnableDelayedExpansion? but I don't really understand it.
TheFastest3Milessupposed to match? or onlytest3?