I shoot RAW+JPG, namely NEF and JPG. After viewing sometimes hundreds of images (using a simple program) and deleting the JPGs, I have many unnecessary leftover NEF files. If there was a script to delete any orphan NEF files in the directory, that would be very helpful. I read a similar question here "How to delete JPG files, but only if the matching RAW file exists?" and the solution presented with the Command Prompt works very well. I was wondering if one was available for my predicament?
I wrote a script in Python to do the work for me. It's called
Basically it iterates over all the files in a given folder and moves orphaned raw images (in my case
Here is an outline of the algorithm:
The tool will tell you how to use it when run with the help option
This problem also occured to me, which is why I wrote this tool. I'm using my DSLR to take JPEG or RAW+JPEG images, never only RAW. When sorting out blurry or otherwise bad shots, I use the JPEGs to quickly take a look at them and delete the bad ones. This leaves me with left over RAW images of which I deleted the matching JPEGs (for a reason).
Using the question you mentioned - I have written you a script
ok warning! be careful with this script! - MAKE A BACKUP
1) Make a bat file called clean.bat and put it in the dir that you want to work with
2) Then enter the following into the bat file
3) Open the command prompt as admin and navigate to the folder with the clean.bat 4) run clean.bat
Basically the flow of the script is
Please, PLEASE test this out!
UPDATE: Made script change to work with folders that have spaces in them
Here's my python script to delete cr2's w/o a jpeg.
It searches recursively within the current directory, ".". It considers all images in all folders.
protected by Community♦ Mar 11 '13 at 20:22
Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?