Skip to content

Instantly share code, notes, and snippets.

@zeffii
Forked from anonymous/file_size_tester.py
Created December 27, 2013 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/8153916 to your computer and use it in GitHub Desktop.
Save zeffii/8153916 to your computer and use it in GitHub Desktop.
# file_size_tester.py
import os
import time
#from json_writer import write_full_json
#while(true)
def test_size(full_path_to_file, predicted_size):
while(True):
try:
stats = os.stat(full_path_to_file)
found_size = stats.st_size
print(found_size)
if found_size > 0:
percent = float(found_size)/float(predicted_size)
# write_full_json(0, wav_name, "wav", percent)
print("percet:", percent)
if found_size >= predicted_size:
break
except:
print("not found yet")
time.sleep(1.0)
pass
time.sleep(2.0)
print("done!!")
full_path_to_file = "C:/Users/dealga/Desktop/code/interesting.txt"
test_size(full_path_to_file, 45)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment