I am running a program that creates a bunch of files in a certain directory, and I want to watch the files get created.
I open two terminal windows and cd one of them (call it terminal A) to the directory of the program (so I can run it) and the other (terminal B) to the directory where the output files get written (this output directory starts out empty). When I touch
a file in the output directory from terminal A then ls
in terminal B, the new file appears -- all this behaves normally.
However, after I run the program in terminal A, none of the new files show up when I do ls
in terminal B. Strangely enough, if I do cd .
then ls
in terminal B, the new files now get listed.
What is causing this behavior, and can I get around it?
Edit: Information about what is writing the files.
- Some are being written by calls to
cv2.imwrite(...)
in Python 2, using OpenCV. - Some are being written by an
ofstream
in C++.