Skip to content

Instantly share code, notes, and snippets.

@elee
Created June 8, 2011 19:11
Show Gist options
  • Save elee/1015126 to your computer and use it in GitHub Desktop.
Save elee/1015126 to your computer and use it in GitHub Desktop.
import os
coredir = "/etc/sv/core"
histfile = "/tmp/corehist.txt"
dirlist = os.listdir(coredir)
dirlist.remove("core")
dirlist.count
with open(histfile, 'w') as f:
value_in_file = f.readline()
if value_in_file == '' or int(value_in_file) != dirlist.count:
f.writeline(dirlist.count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment