Guest User

Untitled

a guest
Jan 15th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. new_files = [] #list of files newer than 1 day
  2. for f in os.listdir(path):
  3. fn = os.path.join(path,f)
  4. ctime = os.stat(fn).st_ctime
  5. if ctime > now - 1 * 86400:
  6. #this is a new file
  7. new_files.append(fn)
  8. if new_files(): #checks the list
  9. sendmail #calls sendmail script that sends email
  10.  
  11. new_files = [] #list of files newer than 1 day
  12. for f in os.listdir(path):
  13. fn = os.path.join(path,f)
  14. ctime = os.stat(fn).st_ctime
  15. if ctime > now - 1 * 86400:
  16. countit=new_files.count(fn) #count previous occurence
  17. #this is a new file
  18. new_files.append(fn)
  19. if new_files.count(fn)>countit:
  20. sendmail #calls sendmail script that sends email
  21.  
  22. Yes: if not seq:
  23. if seq:
  24.  
  25. No: if len(seq)
  26. if not len(seq)
  27.  
  28. if new_files:
Add Comment
Please, Sign In to add comment