Skip to content

Instantly share code, notes, and snippets.

@infontology
Created February 4, 2018 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infontology/b91abc04b82849f8434513f0f98768b6 to your computer and use it in GitHub Desktop.
Save infontology/b91abc04b82849f8434513f0f98768b6 to your computer and use it in GitHub Desktop.
import os
import shutil
raw_ext = '.NEF'
jpg_ext = '.JPG'
destination = 'raws'
for filename in os.listdir('.'):
(shortname, extension) = os.path.splitext(filename)
if extension == raw_ext:
if os.path.isfile(shortname + jpg_ext) == False:
print 'Moving ' + shortname + raw_ext + '...'
shutil.move(shortname + raw_ext, destination)
@infontology
Copy link
Author

Modifierat från ttaveiras script här https://photo.stackexchange.com/questions/16401/how-to-delete-jpg-files-but-only-if-the-matching-raw-file-exists

Obs att mitt syfte är att ta bort raw-filer om inte jpg-filen finns, och inte tvärtom...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment