from typing import Any, Union

from ownLibraries.cloudpipeline import CloudSync

import time
if __name__ == '__main__':
    import os

    # from tqdm import tqdm


    sync = CloudSync()
    counter = 0
    local_counter = -1

    path = os.getenv('HOME') + '/' + '09-09-39/'
    #sync(path_to_folder=path)

    #sync.stop()

    while True:
        counter += 1

        time.sleep(1)
        print(counter)

        if counter == 5:
            local_counter += 1

            try:
                #folder = os.getenv('HOME') + '/' + '2018-02-16_reporte' + '/' + folders[local_counter] + '/'
                folder = path
                print('folder', folder)
                print('local counter', local_counter)
                sync(path_to_folder=folder)
            except Exception as e:
                print(e)
                print('job done')

        else:
            pass