action='store_true') parser.add_argument("--dry-run", help="don't copy files", action='store_true') args = parser.parse_args() root_dir = "/" proc = subprocess.Popen(args.command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=sys.stderr) client = SyncClient(proc) server_files = client.get_file_db() file_finder = FileFinder() with open(args.file_list, "r") as filters_file: file_finder.add_from_text(root_dir, filters_file) created_dirs = {} local_dirs = {} local_files = {} total_uploaded_size = 0 def create_parent_dirs(path): path_dir = os.path.dirname(path) dirs_to_create = [] while not path_dir in created_dirs and path_dir: dirs_to_create.append(path_dir) path_dir = os.path.dirname(path_dir) for dirp in reversed(dirs_to_create): print(f"Creating parent dir {dirp}")