For Loop / File i/o Operation Performance Checkup

Hello.

I'm having a problem in a test environment where I spawned as many as 1200 characters, meaning 1200 directories.

Next, I use find_dorectories to find them, and use for loop to loop through them.

Inside the loop, I performed 1 file i/o operation. The loop reads the file called test.txt, and extract the JSON key called lastseen.

This is fine with 1 or 2 directories, but spawning 1200 directories makes the server to go unresponsive.

Are there any ways that I can fix this, or how should I improve the loop or use another way, in which case please suggest me alternative way to do the similar scenario.