Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

How can I sort by duplicate file names?

New Here ,
Aug 30, 2023 Aug 30, 2023

I sort my photos from a photo session in their .jpeg form because it's way faster to sort than .arw files and I sort them by rating them, then I add all the already sorted .jpeg files in the .raw folder to put the same rating on the .raw files so I can syart editing the picked out photos. Is there anyway to sort by duplicate file names so that I don't have to scroll through thousands of photos and change each rating manually? (I use Bridge on iMac)

TOPICS
How to
253
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Aug 30, 2023 Aug 30, 2023

It pays to keep RAWs and JPEGs in separate folders on separate drives.

I have their containing folders identically named and the images identically numbered so that they are easily coordinated if and when necessary.

Work with the RAWs first - rate, keyword etc then any exif data added to the them is copied identically to the JPEGs when you create them.

Many people don't even bother to keep JPEG files but generate them if and when they are required, but that may not suit your needs.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 30, 2023 Aug 30, 2023
LATEST

As far as I know, there is no way sort by duplicate file names, but there was a very similar question for copying lables between JPEG and PSD files in this post: Copy labels from jpeg proxies to hi res PSDs

 

I have changed the script in that reply to work with ARW files. For any matching filenames, it copies the JPEG rating to the ARW file.

 

The script works on all visible files in the current folder, so navigate to the folder you want in Bridge, then run the script by selecting Tools > Copy Rating (JPEG to ARW). It works for .jpg and .jpeg and is not case sensitive.

 

You should test this before running it on your archive files. Create a test folder and copy a couple of your ARW and JPEG files, then run the script.

 

To save the script file on your drive:

Copy and paste the code below into a text editor, not a word processor.

- Save as using the file extension .jsx

  - If this is not possible, Save as .txt

  - Rename the saved file extension from .txt to .jsx

 

To install it:

  1. Go to Bridge Preferences

    Windows

      - Go to Edit --> Preferences --> Startup Scripts

    Mac:

      - Go to Adobe Bridge --> Preferences --> Startup Scripts

  1. Click "Reveal My Startup Scripts".  This will open the correct folder
  2. Copy the the .jsx file in this folder
  3. Quit Bridge
  4. Start Bridge
  5. When prompted, confirm the installation of the script

 

#target bridge

/*
Terms and Conditions of Use:
MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

// This script will find JPEG and ARW files with the same (exact) name and copy the Rating, if there is one, from the JPEG to the ARW. The file extension is not case sensitive. To change which files are processed., change the values of search1 and search2.

// create menu item in Tools
if (BridgeTalk.appName == 'bridge') {
    var copyLabels_Label = "Copy Rating (JPEG to ARW)"; // use unique variable names at this level to avoid conflicts with other StartupScripts
    var copyLabels_Version = "2023-08-30";
	copyLabels_MenuItem = MenuElement.create("command", copyLabels_Label, "at the end of tools");
}

// when the menu item is clicked, run the script
copyLabels_MenuItem.onSelect = function () {
    copyLabels();
    }

function copyLabels(){
    
    var filePass = 0; // variable to count files successfully updated so it can be reported at the end
    var items = app.document.visibleThumbnails // array of all visible thumbnails in the active content panel
    var itemsCopyFrom = [];
    var itemsCopyTo = [];
    var search1 = ".jpg|.jpeg"; // primary file - label will be copied to search2 file (case insensitive)
    var search2 = ".arw"; // copy label to this file (case insensitive)
    
    // UI window
    var mainWindow = new Window ('dialog', copyLabels_Label);
    mainWindow.alignChildren = ['center','top'];
    mainWindow.preferredSize = [300,200];
    mainWindow.spacing = 10;
    
    var statictext1 = mainWindow.add('statictext', undefined, "For all "+items.length+" selected files...");
        statictext1.alignment = 'fill';
        statictext1.justify = 'center';
        
    var statictext2 = mainWindow.add('statictext', undefined, "when file names match exactly:");
        statictext2.preferredSize.height = 40;
       statictext2.alignment = 'fill';
        statictext2.justify = 'center';
        
    var statictext3 = mainWindow.add('statictext', undefined, "copy Rating from JPEG to ARW");
        statictext3.alignment = 'fill';
        statictext3.justify = 'center';
        
    var statictext4 = mainWindow.add('statictext', undefined, "(file extensions are not case senstive)");
        statictext4.alignment = 'fill';
        statictext4.justify = 'center';
        
    var spacer1 = mainWindow.add('statictext', undefined, "");
                
    var group3 = mainWindow.add('group', undefined); 
        group3.orientation = 'row'; 
        group3.spacing = 20; 
        var group3button1 = group3.add('button', undefined, "Run"); 
            group3button1.preferredSize = [80,30]; 
            group3button1.onClick = editXMP
        var group3button2 = group3.add('button', undefined, "Cancel"); 
            group3button2.preferredSize = [70,25];
            group3button2.onClick = function(){mainWindow.close();}
   
    mainWindow.show(); 
            
    // Functions
    function editXMP(){

        // Load the XMP Script library
        if ( ExternalObject.AdobeXMPScript == undefined ) {
            ExternalObject.AdobeXMPScript = new ExternalObject( "lib:AdobeXMPScript" );
            }

        for (var L1 = 0; L1 < items.length; L1++){ // loop through each thumbnail
            if(items[L1].name.match(new RegExp( search1, "i" )) != null){ // get just the jpg files
                itemsCopyFrom.push(items[L1]);
                }
            if(items[L1].name.match(new RegExp( search2, "i" )) != null){ // get just the arw files
                itemsCopyTo.push(items[L1]);
                }
            } // CLOSE for (var L1 = 0; L1 < items.length; L1++)

            // Since it is much faster to search for an element in an array by its key rather than its value, we create an index array, 'lookup', and copy all of the values from list2 as keys in lookup
            var lookup = {};

            for (var j in itemsCopyTo) {
                var noExt = itemsCopyTo[j].spec.fsName.substring(0, itemsCopyTo[j].spec.fsName.lastIndexOf (".")); // remove extension from file path/name for matching
                lookup[noExt] = itemsCopyTo[j];
                }

            for (var i in itemsCopyFrom) { // find items in itemsCopyFrom in itemsCopyTo
                var noExt2 = itemsCopyFrom[i].spec.fsName.substring(0, itemsCopyFrom[i].spec.fsName.lastIndexOf (".")); // remove extension from file path/name for matching
              if (typeof lookup[noExt2] != 'undefined') { // if there is a matching file name
               // set same label in itemsCopyTo
                var label = itemsCopyFrom[i].synchronousMetadata.read("http://ns.adobe.com/xap/1.0/", "Rating") // read  itemsCopyFrom[i] label
                var label2 = lookup[noExt2].synchronousMetadata.read("http://ns.adobe.com/xap/1.0/", "Rating") // read  itemsCopyTo label
                if (label.length > 0 && label != label2){ // if the jpeg has a label.  if the png has a label, only write if it is different from the jpeg
                    // TODO add options to only copy if JPG has a label or only copy if PNG doe not already have a label?
                    // TODO if JPEG does not have a label and PNG does, should PNG label be deleted?
                if(lookup[noExt2].hasMetadata){
                    // Get the metadata object - wait for  valid values
                    var md = lookup[noExt2].synchronousMetadata;
                    // Get the XMP packet as a string and create the XMPMeta object
                    var xmp = new XMPMeta(md.serialize());              
                    xmp.setProperty (XMPConst.NS_XMP, "Rating", label); 
                    // Write the packet back to the selected file
                    var updatedPacket = xmp.serialize(XMPConst.SERIALIZE_OMIT_PACKET_WRAPPER | XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
                    lookup[noExt2].metadata = new Metadata(updatedPacket);
                    filePass++
                    } // CLOSE if(thumb[L1].hasMetadata)
                    } // CLOSE if (label != label2)
                } // CLOSE if (typeof lookup[noExt2] != 'undefined')
            } // CLOSE for (var i in itemsCopyFrom)

        mainWindow.close();
        Window.alert(filePass+" files updated")
        } // CLOSE function editXMP()
    } // ClOSE function copyLabels()

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines