Using just the command prompt or a batch script, I would like to look inside my current directory and all subdirectories for folders containing a specific filetype.
So, example:
Say I am in directory F:\dir\one\, and F:\dir\one\ looks like this:
F:\dir\one\
|
+--F:\dir\one\two\
| |
| +--file.c
|
+--F:\dir\one\three\
| |
| +--work.py
| |
| +--F:\dir\one\three\four\
| | |
| | +--file2.c
And I ran my command/script looking for *.c files, I would expect an output of
>F:\dir\one\two
>F:\dir\one\three\four
because those folders contain *.c files.
How could I do this?
To be run from command line. For batch files, percent signs need to be escaped, replacing %
with %%
for /r %a in (.) do @if exist "%~fa\*.c" echo %~fa
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With