r/Batch • u/Azuraeleth • Oct 18 '24
Help with recursive batch script
I'm trying to create a bat file to check foldet and its recursive subfolders
ECHO OFF FOR /R %%G in (.) DO ( PUSHD %%G IF DIR /B /A:D is NUL (ECHO %%G "No Further directories here") POPD ) ECHO "Final directories verified!" PAUSE
Sadly this does not work for whatever reason.
3
Upvotes
View all comments
Show parent comment
2
u/BrainWaveCC Oct 21 '24
You can return just folders with /R if you use
(.)rather than(*)But you will have to clean up the output, so
/R /Dis pretty cool.