def read_dir(dir_name): current_path = dir_name files = os.listdir(dir_name) for f in files: if os.path.isfile(current_path + '/' + f): remote_path = Constants.PCS_BASE_DIR + '/' + current_path + '/' + f PCS.upload_file_to_pcs(remote_path, current_path + '/' + f, True) else: read_dir(current_path + '/' + f)