icefall/watchdog_v2.py
2022-12-09 15:53:58 +09:00

22 lines
613 B
Python

import os
import time
lastmod = []
dirToWatchList = []
path = './'
for dirpath in os.walk(path):
if '.git' in dirpath[0]:
continue
dirToWatch = dirpath[0]+'/'
lastmod.append(int(os.path.getmtime(dirToWatch)))
dirToWatchList.append(dirToWatch)
#lastmod = int(os.path.getmtime(dirToWatch))
while True:
for enum, dirToWatch in enumerate(dirToWatchList):
if lastmod[enum] != int(os.path.getmtime(dirToWatch)):
#print('Warning: Modify Detected.')
os.system('./git.sh')
lastmod[enum] = int(os.path.getmtime(dirToWatch))
time.sleep(1.0)