So what I'm trying to do is go into every folder in the following directory
"C:\Documents and Settings\"
and for every folder in it, regardless of the name, check if this path exists
"C:\Documents and Settings\*\Local Settings\Application Data\CSMRpt\"
if it exists then delete all txt files inside that director, if the path doesn't exists then do nothing and move on to the next folder inside "C:\Documents and Settings\"
This is what I came up with so far:
set PATH = "\Local Settings\Application Data\CSMRpt\" set FILETYPE = "*.txt" for /d %%g in ("C:\Documents and Settings\*") do if exist %%g%PATH% goto pathexists :pathexists del %%g%PATH%%FILETYPE%