import os from pathlib2 import Path if __name__ == "__main__": path_data = Path("/ssdata1/lsen/DATA/Actor6/processing") vpath_videos = sorted(path_data.glob("*"), reverse=False) print(f"Have {len(vpath_videos)} dir files") clear_folders = ["frames_crop_parse_512", "frames_crop_parse_skin_512", "frames_crop_parse_vis_512", "DECA_kpt2d", "DECA_coeff", "DECA_kpt3d"] # clear_folders = ["frames_crop_parse_512", "frames_crop_parse_skin_512", "frames_crop_parse_vis_512", "DECA_coeff"] # for each word for i, ipath_item in enumerate(vpath_videos): iname = ipath_item.stem print(f"processing {i}/{len(vpath_videos)} -> {ipath_item} ... ") for kfolder in clear_folders: # if iname not in IDs: continue ipath_fcrop = ipath_item.joinpath(kfolder) if ipath_fcrop.exists(): cmd = f"rm -rf {str(ipath_fcrop)}" print("RUN: ", cmd) os.system(cmd)