Last active
October 18, 2020 20:03
-
-
Save ximeg/f339be3ccada51f9ab44fb91e31cfd13 to your computer and use it in GitHub Desktop.
Move JPG files that do not have a matching raw file
This file contains hidden or 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
#!/usr/bin/env python | |
import os | |
import shutil | |
raw_ext = '.RAF' | |
jpg_ext = '.JPG' | |
destination = 'jpg_only' | |
for filename in os.listdir('.'): | |
(shortname, extension) = os.path.splitext(filename) | |
if extension == jpg_ext: | |
if not os.path.isfile(shortname + raw_ext): | |
if not os.path.isdir(destination): | |
os.mkdir(destination) | |
print('Moving ' + shortname + jpg_ext + '...') | |
shutil.move(shortname + jpg_ext, destination) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment