I trying to analize some file that come through a ftp transfer from many clients to my server (pc). So, I'm constantly getting a list o files using
for dirpath, _, filenames in walk(directoryPath):
for filename in [f for f in filenames if f.endswith(".jpg")]:
files.append(path.join(dirpath, filename))
return files
Because this is running much faster than the file transfer, the script try to open the image, throwing an exception, and I omit it until no more exceptions get throwed. But even there the analysis fail.
I know that my analysis code works because this only occur with new files, and no with the ones that was there on first run.
I use
os.access()
To get the file status, but this only give me the permissions, and no if some process are currently writing data on it.