Created
February 28, 2018 20:03
-
-
Save brianbancroft/b6517448d89623d4069bb0ef08f3554f to your computer and use it in GitHub Desktop.
Convert all jpg photos in ~/Desktop/photos to jpeg
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 re | |
regexp = re.compile(r'\.jpg') | |
folder = os.path.expanduser('~/Desktop/photos') | |
for filename in os.listdir(folder): | |
infilename = os.path.join(folder, filename) | |
if regexp.search(filename): | |
oldbase = os.path.splitext(filename) | |
newname = infilename.replace('.jpg', '.jpeg') | |
output = os.rename(infilename, newname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just copy and paste this into a python terminal