Renaming HTML files using <title> tags
问题 I'm a relatively new to programming. I have a folder, with subfolders, which contain several thousand html files that are generically named, i.e. 1006.htm, 1007.htm, that I would like to rename using the tag from within the file. For example, if file 1006.htm contains Page Title , I would like to rename it Page Title.htm. Ideally spaces are replaced with dashes. I've been working in the shell with a bash script with no luck. How do I do this, with either bash or python? this is what I have so