import sys import re from pathlib import Path for path in Path(sys.argv[1]).rglob('*.svg'): with open(path, "r") as file: data = file.read() if "" not in data: data = data.replace("", "").replace("", "") with open(path, "w") as file: file.write(data)