This question already has an answer here:
I have a python script
$ cat ~/script.py import sys from lxml import etree from lxml.html import parse doc = parse(sys.argv) title = doc.find('//title') title.text = span2.text.strip() print etree.tostring(doc)
I can run the script on an individual file by issuing something like
$ python script.py foo.html > new-foo.html
My problem is that I have a directory
~/webpage that contains hundreds of
.html files scattered throughout sub-directories. I would like to run
~/script.py on all of these html files. How can I do this?
I'm aware that I can list all the
.html files under
~/webpage/ by issuing
$ find ~/webpage/ -name "*.html"
but I'm not quite sure how to use this list to run my script on them.