You could start with something like this:
for /r [[drive:]path] %a in (*.txt) do example.py "%a"
this executes example.py
for every .txt
file, starting from [[drive:]path]
, and recursing subdirectories /r
. If you omit drive:path it will start the search from the current directoty, e.g.
for /r %a in (*.html) do example.py "%a"
for /r C:\ %a in (*.html) do example.py "%a"
The first example executes example.py
for every *.html
file under current dir, the second one executes example.py
for every .html
file under C:\
.
It is also possible to delete changed files, but we need to have some more information. Maybe you just need this?
for /r %a in (*.txt) do example.py "%a" temp.tmp & copy temp.tmp "%a"
Remeber that this works if you launch this command at the command prompt. If you want to use it inside a batch file (.cmd
, .bat
) you have to use %%a
instead of %a
.