Find & delete Jpegs

Pmba

Suspended / Banned
Messages
505
Name
Paul
Edit My Images
Yes
This may be better posted in 'post-processing' section, but here goes.

Over the years I have been shooting raw+jpeg, raw only and jpeg only, filling a 1TB hdd. I use LR to import/catalogue.

I now want to locate & delete all the jpeg files, for only those images that were shot as raw+jpeg, to free up some space.

Is there way of automating/doing this quicky, or will I need to go through the file names and delete individually, given that not all the jpegs will have a corresponding raw file? There will be a few thousand of those.

Thanks
Paul
 
How does LR actually store the files? If each importation goes into a separate folder then you could sort each folder by extension (you'd need to make sure all extensions are visible) which would make it easy to do a block delete.

I expect it could be automated but it would need a script written in an appropriate language.
 
The difficulty is that some Jpg's have raw counterparts and others don't. it would be easy to show only the JPG files using the filters or smart collections, however, this would be all JPG's.

You may be able to do this with a smart collection, but I'm unsure how you'd go about setting it up. I've not used smart collections much, but they normally achieve what I need them too.
 
How does LR actually store the files? If each importation goes into a separate folder then you could sort each folder by extension (you'd need to make sure all extensions are visible) which would make it easy to do a block delete.

I expect it could be automated but it would need a script written in an appropriate language.

Go careful if you delete files outside of Lightroom as the next time you open Lightroom it will list the deleted files as missing, You're always best off managing your catalog from within Lightroom unless you fully understand how Lightroom catalogues the images in the back end.
 
Thanks for the replies, I take the point re managing within Lightroom - seems the methodical approach will be best. l will start this off by looking at each folder in LR and determine if it is exclusively raw+jpeg, if so, filter out the raws and batch delete the jpegs. Time consuming, but safest.
 
Search for *.jpg then select them all and delete them.
 
Write a little powershell or bash script to find each raw files. Then search whether you have a file with the same name ending in .JPG. if you want to be super safe also check the metadata like creation date etc in the script.

Personally I would put them aside first, also keep a log file where you enter the original path before you delete anything.
 
Search for *.jpg then select them all and delete them.

Thanks, but need to keep some jpegs - those that have no equivalent in raw.

Write a little powershell or bash script to find each raw files. Then search whether you have a file with the same name ending in .JPG. if you want to be super safe also check the metadata like creation date etc in the script.

Personally I would put them aside first, also keep a log file where you enter the original path before you delete anything.

Lost me here - but good suggestion on putting aside. Thanks.
 
Have you tried auto stack and making the stack time frame very short. If shot at the same time the jpeg and raw will be together. Any that weren't shot together as raw+jpeg should be easier to spot? It's still a difficult task but I can't think of an easy way.
 
Have you tried auto stack and making the stack time frame very short. If shot at the same time the jpeg and raw will be together. Any that weren't shot together as raw+jpeg should be easier to spot? It's still a difficult task but I can't think of an easy way.
I hadn't but sounds promising! will have a look at the link when I get home. Thanks for that.
 
Doing this would fill me with fear of inadvertently losing stuff, I'd rather buy more storage, it's cheap enough
 
Doing this would fill me with fear of inadvertently losing stuff, I'd rather buy more storage, it's cheap enough
You still have them in your backup. If it goes wrong you simply restore. You do have a backup don't you?
 
You still have them in your backup. If it goes wrong you simply restore. You do have a backup don't you?

Of course I have backups, but storage is cheap, IMO it's not worth the time to find and delete duplicates

If I had to do this, I would write a bash or Python script and then move not delete files, then check and continue. Doing it manually = human error creeping in.
 
Last edited:
Of course I have backups, but storage is cheap, IMO it's not worth the time to find and delete duplicates
My comment was regarding your fear of loosing not whether storage is cheap or not. I don't like to have duplicate files dotted around. Regardless how cheap storage is.
 
In PowerShell it will be something like....

gci -recurse *.jpg | %{ if((test-path $_.filepath.replace(".jpg",".raw")){move-item $_ "D:\temppath\$($_.filename)"}}

That's basically saying get all JPGs, and for each one check to see if there is a RAW file with the same name, if true move it to d:\temppath. It could equally delete the file using "remove-item $_"

Not sure the filepath and filename properties have the right names, and no where near a PC to check.
 
Back
Top