Allen.Kan Allen.Kan - 1 year ago 52
Python Question

How to keep update the files using PYTHON

import os
import glob
import CameraID
files = glob.glob('/tmp/image/*.png')
count = 1
while (count==1):
for image in files:
if ( not os.path.isfile(image)):
print("Error: %s file not found" %image)
print("Sending file %s ..." % image)
print os.remove(image)

When I put the while loop, it will keep run and look for the old file instead the latest file. Anybody can help?

Answer Source

moves the line:

files = glob.glob('/tmp/image/*.png')

into the while loop to keep that updated