title: Pathlib Examples 1 # Get Info Of Mp4 Files Here we use `Path(...).glob("**/*.mp4")` to do a recursive glob. ```py #!/usr/bin/env python import pathlib from subprocess import run, DEVNULL import json root = pathlib.Path(".") files = root.glob("**/*.mp4") data = {} errors = {} for fn in files: fn = str(fn) print(f"{fn}... ",end="") m = run(["ffprobe","-print_format","json","-show_streams","-show_format",fn],capture_output=True,stdin=DEVNULL) if m.returncode != 0: print(f"ffprobe on {fn} returned {m.returncode}") errors[fn] = m.stderr.decode() continue data[fn] = json.loads(m.stdout.decode()) print("done.") with open("mp4s.json","wt") as f: json.dump(data,f) with open("errors.json","wt") as f: json.dump(errors,f) ```