Skip to content

Instantly share code, notes, and snippets.

@joefutrelle
Created August 9, 2017 13:09
Show Gist options
  • Save joefutrelle/501509848aa4328b5e278d9b0e23e171 to your computer and use it in GitHub Desktop.
Save joefutrelle/501509848aa4328b5e278d9b0e23e171 to your computer and use it in GitHub Desktop.
computes rate of mods to files in a directory and reports in files/hr
from __future__ import print_function
import os
import sys
DIR=sys.argv[1]
times = []
for fn in os.listdir(DIR):
path = os.path.join(DIR, fn)
stat = os.stat(path)
times.append(stat.st_mtime)
files = len(times)
hrs = (max(times) - min(times)) / 60 / 60
print('{:.2f} files/hr'.format(files/hrs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment