#! /usr/bin/env python3 from pathlib import Path import os import shutil cwd = Path.cwd() pd = cwd / Path('3rd') for p in pd.glob('*_patch.tar'): d = str(p)[0:-10] if Path(d).is_dir(): shutil.rmtree(d) pc = pd / 'packagecache' for c in pc.glob('*'): os.remove(str(c))