Today, I needed to create an xml sitemap for all the pdf files under a directory as well as inside the sub directories of that directory. Doing that manually requires lot’s of time and energy and that is a complete waste.

So, I started digging and created a very small php script that will list all the pdf files inside the specified directory & serves as an xml sitemap. It made the job done in just a few minutes whereas, manual creation could take hours.

The script is available on github, so you can also use this script which may help you to save some of your valuable time.

Click here to go to github page

The repo currently contains a file that can be used to generate sitemap for pdf’s but you can easily customize it to use for other file formats. I’ll add a few more file type example files soon as well.

That’s it for today, let me know if you have any question about this.