Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am a photographer and generate "raw" and JPG images. At a certain point in my workflow, I need to delete all the JPG images before proceeding. That's easy enough; in Windows Explorer, one can sort by type, then delete all the JPGs, or one could open up a command prompt in the directory and erase *.jpg. But there's a complication; in some modes of the camera, no raw file is generated. In those cases, I just have one .jpg that I want to keep. Here is an example:

img1.cr2
img1.jpg
img2.cr2
img2.jpg
img3.jpg
img4.cr2
img4.jpg

I want to process this directory and end up with one file of each filename, as follows:

img1.cr2
img2.cr2
img3.jpg
img4.cr2

The pseudocode would go something like this:

Sort files by filename fname

IF fname.jpg and fname.cr2 both exist THEN delete fname.jpg

How can I easily do this? Thanks!

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.