upvote
How about

  for wmv in Path(sys.argv[1]).rglob("\*.wmv"):
        print(wmv, end=" ")
        r = subprocess.run(
            ["ffmpeg", "-i", wmv, wmv.with_suffix(".mpg")],
            stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
        )
        lines = [l for l in r.stdout.decode().splitlines() if "kb/s:" in l]
        print("\n".join(lines) if lines else f"ERROR {r.returncode}")
?

If you go outside stdlib you can use the sh library instead of subprocess.run.

reply
deleted
reply
Ruby does a pretty good job, with `system` and backticks. The FileUtils module actually defines some nice helpers like `mv`, `cp` and `ln_s`. So you can do `cp "/tmp/a.txt", filename`. And you can get a list of files matching a glob with `Dir["/tmp/*.txt"]`.
reply
I think Perl is what you're looking for!
reply