Last active
May 23, 2020 10:43
-
-
Save godfather68/b1439ac4b5f87cb001df2d872a6f78d1 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
import os | |
import sys | |
source_path = os.path.dirname(os.path.abspath(__file__)) | |
# test_files_dir = os.path.join(source_path, "test_files") | |
if __name__ == '__main__': | |
files = os.listdir(source_path) | |
for file in files: | |
filename, file_ext = os.path.splitext(file) | |
new_ext = '.PDF' | |
if file_ext == '.pdf': | |
os.rename( | |
os.path.join(source_path, file), # source | |
os.path.join(source_path, filename + new_ext) # dest | |
) | |
sys.stdout.write('Done\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment