I’m trying to set up a watch folder: a folder DAT where I get notifications of only files that are new. I’ve attached a super simple .toe file. It seems to be working but is warning of a dependency loop.
My approach is to have the folder DAT’s callback check a table that is identical to the folder DATs otuput. Thus it checks for pre-existing lines and if not found, append the new file. That way if the folder dat recooks and rescans the folder, only anything we haven’t seen before will be identifiable.
I’m wondering how critical the dependency loop really is (can it be ignored?). Is there a different way to achieve the same result? watchfolder.toe (4.2 KB) Here’s the folder DAT callback therein.
def onFound(dat, info, row):
newfile = dat[row, 0]
newfilepath = dat[row, 1]
# print("got new file: ", newfile, newfilepath)
if op('table1')[newfile, 0] is None:
print("appending: ", newfile)
op('table1').appendRow([newfile, newfilepath])
return
I presume the dependency loop is that I’m both reading from and writing to op(‘table1’). Is there a better way or place to store data like this? Thanks!