import json import glob models = glob.glob("*.h5") for m in models: metadata = {'apix': 10.0, 'timestamp': '20251124113500'} with open(m.replace(".h5", ".json"), 'w') as f: json.dump(metadata, f, indent=2)