Skip to content

Commit fe6cbcd

Browse files
author
Thang
committed
Added additional flags when adding new watches to check for deletion/modification as well
1 parent 3f570cd commit fe6cbcd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

update.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,20 @@ def main():
5353

5454
# A Sub-Directory is added.
5555
if 'IN_CREATE,IN_ISDIR' in event:
56-
cmds = ["echo '%s IN_CREATE %s $# $@ $%%' >> %s" % (workingDir+'/'+changedDir, scriptPath, incrontemp)]
56+
cmds = ["echo '%s IN_CREATE,IN_DELETE,IN_MODIFY %s $# $@ $%%' >> %s" % (workingDir+'/'+changedDir, scriptPath, incrontemp)]
57+
processCmd(cmds)
5758

5859
# A Sub-Directory is deleted.
5960
elif 'IN_DELETE,IN_ISDIR' in event:
6061
cmds = ["sed -i '/%s/d' %s" % (changedDir.strip('/'), incrontemp)]
61-
62-
# A File is added.
63-
elif 'IN_CREATE':
62+
processCmd(cmds)
63+
64+
# A File is added...
65+
# We may need to watch when files are moved to the watched directory as well.
66+
elif 'IN_CREATE' in event or 'IN_MODIFY' in event:
6467
processFile()
6568
sys.exit()
6669

67-
processCmd(cmds)
6870

6971
if __name__ == "__main__":
7072
main()

0 commit comments

Comments
 (0)