Created
February 6, 2013 10:23
-
-
Save level09/4721698 to your computer and use it in GitHub Desktop.
validate that file has finished transferring based on size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from datetime import datetime | |
class FileValidator: | |
@staticmethod | |
def is_ready(file): | |
time_diff = (datetime.now() - datetime.fromtimestamp(os.path.getmtime(file))).seconds | |
if time_diff > 2: | |
print 'File %s is ready !' % os.path.basename(file) | |
return True | |
else: | |
print 'File %s is not ready yet ..' % os.path.basename(file) | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment