Skip to content

Instantly share code, notes, and snippets.

@theharshbhatia
Created April 13, 2014 14:32
Show Gist options
  • Save theharshbhatia/10586570 to your computer and use it in GitHub Desktop.
Save theharshbhatia/10586570 to your computer and use it in GitHub Desktop.
Python file to notify change in folder from a specific point.
import os,datetime
import os.path, time
from os.path import join, getsize
ct=datetime.datetime.now() #current time
# folderpath="/Users/harshbhatia/Desktop/buyingiq/" #folderpath you want to check for modified files
#pushd \\fileserver\Study Material ||all materials go to z drive atomatically
folderpath="/Volumes/Study Material/Computer Science & IT/Even Sem 2014/"
print "NOTLOG for Mac\n"
print "Choose Your Directory"
numofdays=int(raw_input("Please enter days of your absence(eg. 2 ): \n"))
# numofdays=2 #num of days since users havent checked the folder
print ct;
for root, dirs, files in os.walk(folderpath):
for name in files:
tm= (os.path.getmtime(join(root,name)))
tm1= (datetime.datetime.fromtimestamp(tm))
tdelta= ct-tm1
if int(tdelta.days)<=numofdays:
print join(root,name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment