Skip to content

Instantly share code, notes, and snippets.

@godfather68
Last active May 23, 2020 10:43
Show Gist options
  • Save godfather68/b1439ac4b5f87cb001df2d872a6f78d1 to your computer and use it in GitHub Desktop.
Save godfather68/b1439ac4b5f87cb001df2d872a6f78d1 to your computer and use it in GitHub Desktop.
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