Skip to content

Instantly share code, notes, and snippets.

@level09
Created February 6, 2013 10:23
Show Gist options
  • Save level09/4721698 to your computer and use it in GitHub Desktop.
Save level09/4721698 to your computer and use it in GitHub Desktop.
validate that file has finished transferring based on size
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