Very useful to monitor the behaviour of a File Adapter...
#Checks at regular intervals for the presence of a file in a Directory import os import datetime import time dirToWatch = '/data/my/directory' while 1 == 1 : files = os.listdir(dirToWatch) if len(files) > 0: logfile = open("fileslog.log", "a") logfile.write(str(datetime.datetime.now()) + " " + str(files) + "\n") logfile.close() time.sleep(1)
No comments:
Post a Comment