Last active
August 28, 2019 14:43
-
-
Save erenkeskin/1946fef3f167a7b4599886e6417f0d99 to your computer and use it in GitHub Desktop.
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
### Hasan Eren Keskin | |
### http://herenkeskin.com | |
### Change all pdf name with space replaced '-' and lowercase | |
import os | |
import glob | |
path = os.getcwd() | |
# if you want to change jpg or png or whatever you want, you should change only '/**/*.pdf' extension | |
files = [f for f in glob.glob(path + "/**/*.pdf", recursive = True)] | |
# For Turkish Character | |
translationTable = str.maketrans("ğĞıİöÖüÜşŞçÇ", "gGiIoOuUsScC") | |
for file in files: | |
os.rename(os.path.join(path, file), os.path.join(path, file.replace(' ', '-')).lower().translate(translationTable)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment