Building an output filename from an input filename is where I used to write fragile string code.
from pathlib import Path
src = Path("data/report.csv")
print(src.with_suffix(".json"), src.with_name("summary.csv"), src.stem)
This prints data/report.json, data/summary.csv and report. with_suffix swaps only the last extension, so archive.tar.gz becomes archive.tar.zst and not archive.zst. Use .suffixes to see all parts. None of these calls touch the disk, they only build a new path object. Use Path.rename() to actually move the file. Combining it with rglob lets you convert a whole folder of files in a short loop, writing each result next to its source.
Further reading: pathlib documentation