# -*- coding: utf-8 -*- import zipfile, json, os, sys, io sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') BASE = r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\0aaaa4f2f16c46e8964025a5ab0ecc02\_sa_hanhua_out' JARS = ['sa_essentials-forge-1.20.1-1.0.0.jar', 'sa_lib-forge-1.20.1-1.0.1.jar', 'sa_decor-forge-1.20.1-1.0.3.jar'] OUT = os.path.join(BASE, '_tmp', 'herb_dump2') os.makedirs(OUT, exist_ok=True) KEY = 'herb' for jn in JARS: jp = os.path.join(BASE, jn) if not os.path.exists(jp): continue z = zipfile.ZipFile(jp) for n in z.namelist(): if KEY in n.lower() and not n.endswith('/'): dest = os.path.join(OUT, jn.replace('.jar', ''), *n.split('/')) os.makedirs(os.path.dirname(dest), exist_ok=True) with open(dest, 'wb') as f: f.write(z.read(n)) z.close() print('dumped to', OUT) for root, dirs, files in os.walk(OUT): for f in files: print(os.path.join(root, f))