4 Replies Latest reply on Sep 7, 2013 9:32 AM by johnrellis

    Plugin for deleting NEF/raw files based on rating

    andrewmo

      The huge size of NEFs is causing a major problem for me with backups.  What I would love to be able to do is to rate my images in Lightroom and then delete the NEFs (i.e. raw files) for images that are less than 4 stars.  I want to keep raw files around for those really great shots to process enlargements etc but for 90% of the images keeping the jpg around is enough.

       

      Rob Cole has a plugin that deletes jpgs associated with raw files (almost the oposite of what I want to do) but it doesn't filter based on rating.  He even provides the source code - thanks Rob - but this seems to be part of a much larger framework so it might be more trouble to modify his code than start from scratch for this "little" task.

       

      I'm a proficient C# developer but I'm new to Lua and particularly Lightroom plugins.

       

      It seems like this would be very straightforward to do but getting started wtih plugins seems to be a pretty steep learning curve.

      What I would like to do is to:

      1. Select a number of images in Lightroom (i.e. multiple folders in the library).
      2. Launch plugin (not sure what type of plugin would be appropriate)
      3. Loop through each image in the selection and if the rating is <4 stars (photo:getFormattedMetadata??), delete the corresponding .NEF file while keeping the .jpg. (LrFileUtils.delete??)

       

       

      It looks like there are Export plugins and Publish plugins but neither of these seem to be what I want.  I don't want Lightoom to actually export or publish the files, I just want to process them. What is the best way to get started with this - is there an example template that gets me most of the way there with this?

       

      What about this task is going to be hard - i.e. what problem am I going to run into that I don't forsee? (I'm only doing this on Windows if that helps/hurts)

       

      Sorry if this is a total nube question but sometimes just getting started on a project is the hardest part.

       

      Thanks,

        • 1. Re: Plugin for deleting NEF/raw files based on rating
          johnrellis Most Valuable Participant

          Andrew,

           

          I think I'm not understanding the need for a plugin here -- why wouldn't you just do this manually in LR?  Define a filter / smart collection that searches for .NEFs with less than 4 stars;  select the result; delete.  If you're concerned that a .NEF doesn't have the same star rating as its corresponding .JPG (a LR misfeature of stacks), you could use the Syncomatic plugin to ensure that they have the same rating.

          • 2. Re: Plugin for deleting NEF/raw files based on rating
            andrewmo Level 1

            The problem is that the NEFs and jpgs are shown in Lightroom as a single entity - the NEF.  However, if I delete it, then it deletes both the NEF and jpg.  I'm just trying to get rid of the large NEF, not the whole image.  It is like there is a pseudo-stack because both files are linked but the option to unstack is grayed out.

             

            I tried what you suggested in creating a smart collection (File type=raw; Rating less than 4 stars) but Lightroom says you can't delete directly from a smart collection.  I then switched to a specific folder with the same selection still selected and did Delete Photos. This deleted both the NEF and the jpg. I

            had a backup of the folder so no harm done but this is what I was trying to avoid.  Doing the same thing in a custom filter in the Library panel had the same result - both the NEF and jpg were deleted even though the filter said (File Type: Raw; Rating <= 3 stars).  This is why I thought I would have to code a plugin.

             

            Is there a way to select just  the NEF and delete them?

             

            If I manually delete the NEFs, I get the result I want, but this is extreemly tedious since I can't see the rating in Windows Explorer.

            • 3. Re: Plugin for deleting NEF/raw files based on rating
              areohbee Level 5

              andrewmo wrote:

               

              The problem is that the NEFs and jpgs are shown in Lightroom as a single entity

              You can separate your NEFs and JPEGs, e.g. using RawPlusJpeg.

               

              Afterward, you can use Relative Antics to delete all NEFs which have a rating of 4+, but only if their jpeg exists, and you can transfer the 4 rating to the jpeg at the same time if you want. You'll probably need a few lines of code in the lua text config file for all of that.

              • 4. Re: Plugin for deleting NEF/raw files based on rating
                johnrellis Most Valuable Participant

                The problem is that the NEFs and jpgs are shown in Lightroom as a single entity - the NEF.

                Ah, I forgot about that option.  I turned off the option to pair JPEGs and raw files a long time ago, precisely because of issues like this.  Often I export a JPEG back into the catalog, and it gets stacked with the raw as a separate image -- much easier for me to manage.