Reading files from 10000 sub directories
I have to recursively read files from 10000 subdirectories. Each subdirectory might have 1000+ files. What would be the best way to read directories recursively ? Is there anything better than calling listFiles and then checking if it's a directory. I am planning to read 1000 files during one cycle.
Your hierarchy structure is nothing but a tree.
For example take this strucutre:
A
/ \
BC
/\ /\
/\/\
F GDE
Each node is a directory and the leaf node is file.
You can use Post Order Traversal. That is Left-Right-Root. You can select any traversal technique. All you have to do is check that each element you are currently handling is a leaf node or not.