Created
June 28, 2017 20:41
-
-
Save garsaud/0e0138ac47d2e7f212942d44c16b90f3 to your computer and use it in GitHub Desktop.
Rename files in current directory to lowercase. Also works on windows.
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
import os | |
""" | |
Make every filename within the same directory lowercase, adding a temporary | |
character in the process to fool windows into believing that the filename has | |
really changed (windows treats filenames as case insensitive) | |
Usage: python lowercase.py | |
""" | |
c = "-" | |
path = os.getcwd() | |
filenames = os.listdir(path) | |
for filename in filenames: | |
os.rename(filename, filename+c) | |
os.rename(filename+c, filename.lower()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment