Moonrise & Aurora

Moonrise & Aurora

by Jakub

submit your photo


Picture of the Week Themes
Suggest and vote on themes

Please participate in Meta
and help us grow.

Tell me more ×
Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. It's 100% free, no registration required.

My early (Canon G2) photos are all JPG, but when I got my Nikon D90 I initially shot in JPG, then switched to RAW+JPG, and now I would like to switch to RAW only.

I have literally thousands of photos on my HDD. The photos are in sub-directories (by date) under a single directory called Import.

I am about to import all these photos into Lightroom 3.0, however, I would like to delete all the JPG files, but only where there is already a corresponding RAW file (ie. I no longer want to keep JPG and RAW versions of the same file).

If I can do this easily within Lightroom (after importing everything, including the duplicate JPG files) that would be great. It would also be OK if there were an easy way to do this before importing the files (but hopefully this wouldn't involve having to visit every directory looking for filenames with both JPG and NEF extensions).

Does anybody know of a way to do this (in Lightroom, or with some tool/script in Windows)?

share|improve this question
Do all of your jpg files and RAW files have at a minimum the same string(other characters could be added to either)? Eg IMG_1234_portrait_picture.jpg & IMG_1234.CR2. – dpollitt Oct 15 '11 at 3:28
I think that all of my JPG/NEF pairs have exactly the same filename (except for the extension). – seanmc Oct 15 '11 at 3:29
1  
I will vote to move this to Stack Overflow, where you should get an answer within minutes =) – anon Oct 15 '11 at 15:17
1  
@anon: How exactly does this belong on StackOverflow? This is most definitely an on-topic question here, as it deals with image management and photo editing tools. Outside of a tangential reference to script...this has nothing to do with programming. – jrista Oct 15 '11 at 17:04
@jrista - The asker said it was okay to process the files/folders before importing into Lightroom. To me, a scripting solution would be ideal because it would be tool-independent, faster, more portable, and customizable. In an abstract sense it is even independent of the actual type of files we're dealing with. But then again, I'm a programmer =) – anon Oct 15 '11 at 17:27
show 4 more comments

2 Answers

up vote 8 down vote accepted

In your command prompt, go to the folder and run this:

for /f "delims==" %r in ('dir /b *.nef') do del "%~dpr%~nr.jpg" 2> nul

Basically, it goes through the current folder, runs through the .NEF files, and deletes the JPG if present. It ignores any errors if the JPG is not there.

If you want subfolders, include "/s" (without quotes) in the dir command.

share|improve this answer
1  
Perfect, thanks! Of course before I ran it the first time, I changed "del" to "echo". Then I ran "help for" to understand what it was doing. It's obviously been a long time since I've looked at command prompt scripting, because I had no idea that the "for" command had so many options. – seanmc Oct 16 '11 at 20:14
No problem! As I was testing, I also used "echo" =) To see more output, remove the "2> nul." I'd been meaning to do something like this for my own NEF/JPG files, and this was the perfect opportunity. – anon Oct 17 '11 at 2:14
  • Create an empty Library
  • From the Lightroom main menu, choose Edit > Preferences (Windows) or Lightroom > Preferences (Mac OS).
  • In the General preferences unselect "Treat JPEG Files Next To Raw Files As Separate Photos"
    • This should be the default.
  • Import all of your files (you can select search subfolders), telling it to move to a new location
  • The JPG files that have RAW files will be left in the original location for you to remove

As I understand it, the thumbnail in lightroom might say RAW+JPG, but the JPG isn't actually stored or accessible in any way.

You can also write a pretty simple batch script with any programming language.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.