Windows batch script to find largest PDF file in subfolders and print with path in footer using Ghostscript and `pdftk`

StackOverflow https://stackoverflow.com/questions/22911850

Question

I have a large number of directories, and there are a lot of PDF files in them. I have to print the largest PDF file in each subdirectories with the path in the footer. I have searched a lot on the internet, and have found this article.

Based on it, I managed to create a new PDF manually with the path in the footer, but I can't really understand how to write a batch file in order to make it automatic. So I need to find the largest PDF in the subfolders, define actual path, and add path to footer, and then save them as a new file in the current subdirectory. Can you please help me with this? Thanks a lot!

Was it helpful?

Solution

I see no one has answered; but I see much of the answer is in the superuser article you cited. They show (in one of the answers) a complete batch file for adding the pdf footer.

All you need now is to find the largest file. Elsewhere on stackoverflow there is a script for doing that. I found it here using the search: select file with the largest number of lines.

Do you want someone to do the job for you, as there are plenty of sites that allow you to advertise for a contract programmer! Have a go at calling one batch file from the other and then come back with more questions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top