Files
netbox-repo/scripts/fix-filename-underscores.py
Ryan Merolle 03dd6198b1 Lint fixes (#2485)
* update markdown
* lint updates
* markdown lint updates
* markdown code block fixes
* read add test tube to markdown
2024-11-08 12:01:08 -05:00

18 lines
533 B
Python

from os import walk, path, rename
import yaml
root_dir = f"{path.dirname(path.realpath(__file__))}/../device-types"
# root_dir = f"{path.dirname(path.realpath(__file__))}/../device-types/Cisco"
total = 0
for root, dirs, files in walk(root_dir):
for file in files:
if file.split(".")[1] == "yaml" or file.split(".")[1] == "yml":
fileChanged = False
if file.split(".")[0].count("_") > 0:
newname = file.replace("_", "-")
rename(f"{root}/{file}", f"{root}/{newname}")
print(f"Total Left: {total}")