Last active
March 1, 2023 14:46
-
-
Save nnnolan/4c9a44062ceff9bca0eaf0e827752abf 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
#quick fix for export pdf's still having the extension, we don't want that | |
directory = os.fsencode(os.path.join("exports")) | |
for file in os.listdir(directory): | |
filename = os.fsdecode(file) | |
if filename.endswith(".pdf"): #filename.pdf | |
os.rename(os.path.join("exports", filename), os.path.join("exports", filename.split(".")[0])) | |
if filename.endswith(")"): #filename.pdf(1) | |
temp = filename.split(".")[0] + '_' + filename[-3:] | |
os.rename(os.path.join("exports", filename), os.path.join("exports", temp)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment