11 Replies Latest reply: Aug 14, 2012 3:34 PM by Muppet Mark RSS

    Bridge CS6 - How to rename 50,000 RAW Files?

    Five0Guy Community Member

      Hi Folks,

       

      Let me just say this, so I can get it off my chest ... Adobe why on earth did you make these forums the most maddeningly formatted I have ever used. Not intuitive at all and needlessly complicated and precious. I thought you guys were good at this stuff?

       

      Whew ...

       

      I have about 50,000 raw files all rated, labeled and keyworded. They are in about 450 folders but the numbering of the files is just whatever my particular Canon camera of the day had at the time. I'd like to change the filenames to my initial and last name, date (YR,MONTH,DAY), a number from 0001-9999 (for that particular date) and a two letter suffix.

       

      For instance:

       

      fguy_120109_0001_SF.CR2

       

      The question is, is there some way to automate this without having to go to each folder separately, select all the files and rename? Can this be automated? Otherwise thats 450 folders to deal with.

       

      Suggestions please.

        • 1. Re: Bridge CS6 - How to rename 50,000 RAW Files?
          Muppet Mark Community Member

          Batch Rename under menubar/tools can do all of the above… Very easy to use ( has regexp too ) Script could do all your folders in 1 go… Depending on your platform you could also do this outside of Bridge…

           

          Screen shot 2012-08-10 at 09.34.30.png

          • 2. Re: Bridge CS6 - How to rename 50,000 RAW Files?
            Five0Guy Community Member

            Mark,

             

            Whats my best resource for learning how to make a script? I have no prior experience for making scripts for Bridge.

             

            Thanks

            • 3. Re: Bridge CS6 - How to rename 50,000 RAW Files?
              Muppet Mark Community Member

              Learning to script is not something thats done overnight… Well for me it was/isn't… If you require lots of scripted solutions its worth while it can save you lots of time but theres a learning curve… If this is your only need then someone may help but you would need to supply more details… I don't have CS6 but that may or may not be a problem… What OS are you using and where are the folders all in the same directory?

              • 4. Re: Bridge CS6 - How to rename 50,000 RAW Files?
                Five0Guy Community Member

                Mark,

                 

                I have both CS5 and CS6, if thats helpful. Im using a Macintosh with OSX 10.6.8. The folders are segregated on a separate external drive. At this point pretty much just need one script.

                • 5. Re: Bridge CS6 - How to rename 50,000 RAW Files?
                  Muppet Mark Community Member

                  Hello, I've put bridge as the script target for this although it isn't actually using Bridge scripting commands… Give it a try on a smaller selection and see if it works… I only tested with 4 folders of a dozen files each looks pretty close to what you asked although date is vauge… Created date, modified date todays date?

                   

                  #target bridge
                  
                  reNameFiles();
                  
                  function reNameFiles() {
                  
                            var top = Folder.selectDialog( 'Please select the top level folder' );
                  
                            if ( top != null ) {
                  
                                      var crFiles, folders, countA, countB, i, j, date, newName;
                  
                                      folders = top.getFiles();
                  
                                      countA = folders.length;
                  
                                      for ( i = 0; i < countA; i++ ) {
                  
                                                if ( folders[i] instanceof Folder ) {
                  
                                                          crFiles = folders[i].getFiles( /\.CR2$/i );
                  
                                                          countB = crFiles.length;
                  
                                                          for ( j = 0; j < countB; j++ ) {
                  
                                                                              date = '120109_'; // You may need to change this…??????
                  
                                                                              newName = 'fguy_' + date + zeroPad( j, 4 ) + '_SF.CR2';
                  
                                                                              crFiles[j].rename( newName ); 
                  
                                                          };
                  
                                                };
                  
                                      };
                  
                            };
                  
                  };
                  
                  function zeroPad( n, p ) {
                  
                    var t = n.toString();
                  
                            while ( t.length < p ) { t = '0' + t };
                  
                    return t;
                  
                  };
                  
                  
                  • 6. Re: Bridge CS6 - How to rename 50,000 RAW Files?
                    Muppet Mark Community Member

                    Ha ha… just noticed I started numbering from zero (idiot)… that's why Im a muppet…

                    • 7. Re: Bridge CS6 - How to rename 50,000 RAW Files?
                      Muppet Mark Community Member

                      Was pottering about so I put some date options in and fixed my zero error…

                       

                      #target bridge
                      
                      reNameFiles();
                      
                      function reNameFiles() {
                      
                           var top = Folder.selectDialog( 'Please select the top level folder' );
                      
                           if ( top != null ) {
                      
                                var crFiles, folders, countA, countB, i, j, date, newName;
                      
                                folders = top.getFiles();
                      
                                countA = folders.length;
                      
                                for ( i = 0; i < countA; i++ ) {
                      
                                     if ( folders[i] instanceof Folder ) {
                      
                                          crFiles = folders[i].getFiles( /\.CR2$/i );
                      
                                          countB = crFiles.length;
                      
                                          for ( j = 0; j < countB; j++ ) {
                      
                                               //date = '120109'; // A hard coded String Date…
                      
                                               date = new Date(); // Today's Date
                      
                                               //date = crFiles[j].modified;  // File Modified Date
                      
                                               //date = crFiles[j].created; // File Created Date
                      
                                               date = getDateYYMMDD( date );
                      
                                               newName = 'fguy_' + date + '_' + zeroPad( j+1, 4 ) + '_SF.CR2';
                      
                                               crFiles[j].rename( newName ); 
                      
                                          };
                                     };
                                };
                           };
                      };
                      
                      
                      function zeroPad( n, p ) {
                      
                           var t = n.toString();
                      
                                while ( t.length < p ) { t = '0' + t };
                      
                           return t;
                      
                      };
                      
                      
                      function getDateYYMMDD( d ) {
                      
                           var yy = String( d.getFullYear() ).substring( 2, 4 );
                      
                           var mm = d.getMonth() + 1;
                      
                           if ( mm < 10 ) { mm = '0' + mm };
                      
                           var dd = d.getDate();
                      
                           if ( dd < 10 ) { dd = '0' + dd };
                      
                           return yy + mm + dd;
                      
                      };
                      
                      • 8. Re: Bridge CS6 - How to rename 50,000 RAW Files?
                        Five0Guy Community Member

                        Hi Mark,

                         

                        Thanks so much for creating the script. As you probably imagined, fguy (FiveOGuy) isn't my real name,  I'll probably change the "SF" suffix as well. I can see where those are added in the script so I imaging I can just edit it in those locations.

                         

                        So, I launch Bridge which typically looks for my external drive "FiveOGuys Photography Drive". I see Bridge open on my desktop, what is the next step to run the script? I believe the script has to be run via an application (built into OSX)?

                         

                        I get that I should try this on a test sample of folders, so I'll just copy a few folders over to my desktop from "FiveOGuys Photography Drive" and use those. How do I direct the script to the test folders (I imagine I would put those three into a single folder lets say called "TEST") and then to the entire drive after testing?

                         

                        Thanks

                        • 9. Re: Bridge CS6 - How to rename 50,000 RAW Files?
                          Muppet Mark Community Member

                          As it stands the above will run-in bridge as target… To run it would be best just to use the ExtendScript Toolkit… This can be found…

                           

                          HD/Applications/Utilities/Adobe Utilities - CS5/ExtendScript Toolkit.app

                           

                          Just cut and paste from here into a new window and run… ( on a test folder first )

                           

                          It should ask you to select a top level folder/directory…

                           

                          It currently uses today's date but I also left other options behind comments… the // lines…

                           

                          Any problems give us a shot back should be close to what you asked…

                           

                          If you like it save it using the Toolkit… It's possible to add this to Bridge UI if wanted…

                          • 10. Re: Bridge CS6 - How to rename 50,000 RAW Files?
                            Five0Guy Community Member

                            Mark,

                             

                            One more question my folders are currenttly labeled like: 12_08_11. Year, Month, Day. Does the script indicate that the raw files are to be dated by referencing the date of the folder thay are in? That would be the intent.

                             

                            Thanks

                            • 11. Re: Bridge CS6 - How to rename 50,000 RAW Files?
                              Muppet Mark Community Member

                              How or where the date part of the new name comes from is purely down to you… You didn't indicate that was the case that's why I asked and offered several possibilities… Sure if that is the case then it's easy enough to get the name of the parent folder and use that…