While working on this website, I had the curiosity to find out how many HTML and image files Pelican was generating behind the scenes. I had no utility at hand to count files recursively through folders and subfolders, so I decided to create my own using Python.
The application started with just a few lines of code in Pythonista right on my iPhone. Then I went on to add a few details. And now it’s kind of ready to use. Here is how it works:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
All the arguments indicated above, including the path, are optional and you may use whatever order you prefer. So the most simple way to use it is just by typing
countfiles.py and let it use the default options to scan the current working directory:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Sometimes, you may want to turn off the table and just obtain a count of all files:
1 2 3 4 5 6
You can download the source code and read a more complete description of this application on GitHub. Check it out!
Have a better idea?
If you have come up with a better solution for these problems, please let me know.