Created
November 23, 2010 15:33
-
-
Save itayd/711941 to your computer and use it in GitHub Desktop.
scans current directory, when a file's mtime is change, execute command in args concatinated to filename
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import time | |
latest = {} | |
while True: | |
fs = os.listdir('.') | |
for f in fs: | |
s = os.lstat(f) | |
changed = True | |
if f in latest.keys(): | |
changed = s[8] != latest[f] | |
latest[f] = s[8] | |
if changed: | |
print f | |
time.sleep(1) |
Author
itayd
commented
Nov 23, 2010
- does shallow scan
- does not take into account deleted files
- checks only mtime
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment