You can do this by iterating over all your files and adding the contents of the <body>...</body> together programmatically.
- Get all html file names in
ArrayList<String> - Create
StringBuilder - Read each HTML file line by line until you find a line with the body tag
- Reading from this tag begins until you find a line with the closing of the body tag
- Add this content to
StringBuilder - After all the files have been read, write the contents of
StringBuilder to a single file.
At the end you will get one HTML file
source share