furas

wait for end of download

Jul 29th, 2018
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. while True:
  2.     wait = False
  3.    
  4.     for i in os.listdir("D:/Downloads"):
  5.         if ".crdownload" in i:
  6.             wait = True
  7.             break # no need to check other files
  8.        
  9.     if not wait:
  10.         break # exit `while True`
  11.    
  12.     time.sleep(0.5)
  13.  
  14. print("download complete")
Add Comment
Please, Sign In to add comment