Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. import time
  2. import os
  3.  
  4. write_file = 'C:\Users\Administrator\Downloads\zzz.log'
  5. w_file = open(write_file, 'w')
  6. w_file.write('testing\n')
  7. w_file.close()
  8.  
  9.  
  10. while True:
  11. file = 'C:\Users\Administrator\Downloads\somefile1'
  12.  
  13. if os.path.isfile(file):
  14.  
  15. # open file and obtain content
  16. f = open(file, 'r')
  17. content = f.read()
  18.  
  19. if content == "remove file x":
  20. print "x"
  21. elif content == "invoke autoit script x":
  22. print "y"
  23.  
  24. # close file handle
  25. f.close()
  26.  
  27. # remove file so this condition doesn't happen again
  28. os.remove(file)
  29.  
  30. # optional sleep for five seconds
  31. time.sleep(5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement