Skip to content

Instantly share code, notes, and snippets.

@zeffii
Forked from anonymous/file_size_tester.py
Created December 27, 2013 23:08

Revisions

  1. @invalid-email-address Anonymous created this gist Dec 27, 2013.
    31 changes: 31 additions & 0 deletions file_size_tester.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    # 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)