Created
March 12, 2021 08:36
-
-
Save imhemish/569f2c448d6a6295038869860bce6f75 to your computer and use it in GitHub Desktop.
renameTitleCase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Replace mp3 with whatever files you want to rename to title case | |
# Original: this is a gist | |
# After rename: This Is A Gist | |
import os | |
listing = os.listdir() | |
filtered = [] | |
work = [] | |
for item in listing: | |
if ".mp3" in item: | |
filtered.append(item) | |
for item in filtered: | |
if (((item.split(".mp3"))[0].title())+".mp3") != item: | |
work.append([item, (((item.split(".mp3"))[0].title())+".mp3")]) | |
print(work) | |
for item in work: | |
os.rename(item[0], item[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment