import os from pathlib2 import Path if __name__ == "__main__": path_data = Path("/ssdata1/lsen/DATA/Actor5/processing") vpath_videos = sorted(path_data.glob("*"), reverse=False) print(f"Have {len(vpath_videos)} dir files") # IDs = ["2-23min"] # for each word for i, ipath_item in enumerate(vpath_videos): iname = ipath_item.stem print(f"processing {i}/{len(vpath_videos)} -> {ipath_item} ... ") # if iname not in IDs: continue ipath_fcrop = ipath_item.joinpath("frames_crop") ipath_tfrom = ipath_item.joinpath("frames_crop_tform") if ipath_fcrop.exists(): cmd = f"rm -rf {str(ipath_fcrop)}" print("RUN: ", cmd) os.system(cmd) if ipath_tfrom.exists(): cmd = f"rm -rf {str(ipath_tfrom)}" print("RUN: ", cmd) os.system(cmd)