Link to home
Start Free TrialLog in
Avatar of CalmSoul
CalmSoulFlag for United States of America

asked on

batch file to check for file in all folder

How can I check if "results.txt" exist in all sub folder under "C:\folder\results\"?
Avatar of Qlemo
Qlemo
Flag of Germany image

I.e. each subfolder has to contain results.txt, and you want to see which one does not?
Avatar of CalmSoul

ASKER

Yes
for /F "tokens=*" %%F in ('dir /a:d') do if not exist %%F\results.txt echo %%F

Should give the starting folder, too, and do all folders, of course:

for /F "tokens=*" %%F in ('dir /a:d /s /b C:\folder\results\') do if not exist %%F\results.txt echo %%F
So what is the output? I only want those folders list which doesn't contain results.txt
Try it ... It should do exactly that. If you want to try it on command line (outside of a batch file), you have to replace %% by %.

ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
getting message "d" was unexpected at this time
Did you copy the code exactly as-is?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry??? That solution is just an expansion of mine.
sorry i got confuse... I should have split points
CalmSoul

I'm quite happy for you to summon a moderator to re-open this question providing you ACCEPT my code as the solution (as you have done above) and award Qlemo ASSISTED in the solution. I will agree to a 50/50 split in points. Finally, a grade 'A' would ensure we get the 'full' points awarded.

To summon a moderator: click on "Request Attention" (bottom right near red icon of your question above)
In my previous post, I stated quite clearly I was happy for you to re-open this question and award points to Qlemo however, I did stipulate 3 conditions. These were:

(1) you "ACCEPT" my code as the solution, and award "ASSISTED" in the solution to Qlemo

(2) a 50/50 split in points

(3) a grade 'A'

While you satisfied  (2) and (3), you did NOT "ACCEPT" my code as the solution. I have been awarded points on the basis that I only "ASSISTED" in the solution.

This is unfair as it was in good faith that I agreed for you re-open this question.
Ohh you want accepted and his assited?

If that is the case reopen the question I will do that... I am rookie is accpet multiple solutions
CalmSoul

When you close a question you are given the option of accepting multiple comments as your solution.

The first comment you should click on is the one which you select as your ACCEPTED solution then after, you select others as ASSISTED in that solution.

I fear, because Qlemo's solution appears chronologically before mine, you clicked on that one first then proceeded to click on mine and this is why the ACCEPTEDB and ASSISTED are in the order as they are.
Sorry, didn't realise off topic was remmoved due to not refreshing my browser before posting.
WhackAMod

Why won't you allow me to make general comments to Qlemo? I'm not breaking any rules. I'm not going off on a rant. I'm not using unacceptable tone. Please allow me the freedom to post messages. If I am doing something wrong them please say so otherwise it appears you are spiting me.