14 Replies Latest reply on Aug 7, 2014 12:24 PM by Jeffko

    Organize a total mess of several thousand jpegs into timestamped folders

    dutotone Level 1

      Hi!

       

      Situation:

      My sisters photo collection is a total mess without any rational system to it. Its just illogical structured with folders with generic keywords and thousands of files within each folder. For example, there it's a folder called "travel" where she has just dumped thousands of single files from 10 years of vacations. Not the mention the "various" and "misc" folders. You get the idea. *lol*

       

      What I am trying to do:

      It does seem like all the photos have the correct EXIF data on them though. So what I'm looking to do is to restructure the collection in folders (with dates taken from EXIF) in a manner similar to this:

       

      "/various/filename.jpg" ---> "/2012_06_25/filename.jpg"

      "/friends/filename.jpg" ---> "/2012_05_01/filename.jpg"

       

      and so on.

       

      At least then it gets some kind of chronological structure to it. I want to physically organize the files, not organize them through a database.

       

      What is the best approach for doing something like this? I guess I could just batch rename everything from the exif data with Bridge and then organize it from there - but this will still be very tedious. There must be a better way (anyone know of any PS/Bridge scripts that can do this? The more automated the better. I use Bridge and I dont have LR - but if LR can do this it *might* be whats finally pushing me to buy it.

       

      I greatly appreciate any advice as to how to go about this!

        • 2. Re: Organize a total mess of several thousand jpegs into timestamped folders
          Trevor.Dennis Adobe Community Professional (Moderator)

          I don't know what OS you are using, but even without Bridge it would not be arduous a job. If Windows, then simply setting the folder view option to Details. Right click one of the headings and add ‘Date taken’ (if not already there), and you are in business.

           

          Windows 7 makes it easier still with its clever way to arrange open folders by using the cursor keys in conjunction with the Windows key (between Ctrl and Alt).

           

          [EDIT] I don't like Lightroom and get on well enough with Bridge, but I arrange my images in folders with Year, month, day followed by a meaningful name. i.e. '2012_06_25 meaningful name'. that ensures they display in the right order in folders. Now this is probably not the ideal method, but I actually use flickr to find a particular image. I will generally upload the best few images from a shoot to my flickr stream, and it is easy to find them with the flickr search which will give me a date take. Client folders are kept separate, and as I don't need an income, I am very selective about what client work I take on nowadays, so it is not hard to find the relevant folder. That has only ever happened once when a client lost their digital image files.

          • 3. Re: Organize a total mess of several thousand jpegs into timestamped folders
            dutotone Level 1

            Hi

             

            Thanks for the replies.

             

            station2: ill try it! but im not very hopeful, i see the forum is virtually dead

             

            trevor: The problem is not sorting the files but to actually restructure the folder/file structure permanently. I could of course do it manually as you described - but this would mean ALOT of work. Like I said it's 10 years + of images - this would  easily mean creating 500 dated folders by hand and then move files manually. I am looking for an automated process (the only option really).

            • 4. Re: Organize a total mess of several thousand jpegs into timestamped folders
              dutotone Level 1

              If I could just put all the images on a mounted virtual partition/blank usb hdd or whatever and trick Bridge into thinking this was a camera device - I could then simply use the "get photos from camera" option and bridge would import and sort everything into folders by date as it normally does. Problem solved.

               

              I realize this is a far fetch but if anyone has a trick up their sleeve to fool bridge in such a manner I would really like to know about it

               

              I am actually considering putting the images chunk by chunk on my eos camera which has a 16gb cf card on it and "get photos from camera" ...lol. Not entierly sure if this will work though, as none of the images are actually captures with this camera - theyre captured with different point and shoots, ipods and cell phones.

              • 5. Re: Organize a total mess of several thousand jpegs into timestamped folders
                Trevor.Dennis Adobe Community Professional (Moderator)

                One thing that would worry me is how old, and what spec your hardware is?  Bridge can get very bogged down with even a few hundred files in a folder.  I can't remember whether this was influenced by the Photoshop/Bridge version number, or just hardware.  If your only criteia for sorting and organising ia date taken, then I would not have thought it too big a job to do manually.

                • 6. Re: Organize a total mess of several thousand jpegs into timestamped folders
                  BOSU BABU Level 1

                  This was also my position before I purchased Lightroom.Now I can view photos monthwise datewise or yearwise amongst other categorisations like name or groups. Lightroom is the best one for file management.Even you can import photos into LR structure without actually moving.Hence your old photos will remain at same place.I preferred to move all my photos in to a separate folder which again has subfolders divided into year,month, date. For a beginner it is daunting to learn,but once you come into grip you enjoy having such a control of your photos

                  • 7. Re: Organize a total mess of several thousand jpegs into timestamped folders
                    Paul Riggott Level 6

                    I think this should be possible with either Photoshop or Bridge depending on what version of Photoshop you have? It would also be useful if you mentioned what OS you are using, as this will make a difference on the choice of Photoshop/Bridge script.

                    If you can give this information I will try and put something together.

                    • 8. Re: Organize a total mess of several thousand jpegs into timestamped folders
                      dutotone Level 1

                      Hi

                       

                      Paul Riggott: I have a workstation with full version PS5/Bridge CS5 - but I also have the CS6 trial version (not expired) installed on a laptop. Both run win7x64. The images in question are on a portable USB HDD so it doesnt really matter what PC I am using to organize it.

                       

                      But wow - would you really be willing to attempt to solve this with a script? Now I kind of feel guilty asking! (I have to ask, are you compensated by Adobe for such efforts?)

                       

                      This problem is a bit of a bugger as Bridge actually do have the excact function I am seeking built right into it - but it can only be accessed when downloading images from something it recognizes as a camera device.

                       

                      babu: The end user in question here is not familiar with LR and I doubt she is willing to purchase/learn it. We are talking windows thumbnails and microsoft picture viewer here. Like I said, the problem is not MY collection of photos - but an external collection. But thanks for the LR info anyways!

                      • 9. Re: Organize a total mess of several thousand jpegs into timestamped folders
                        Paul Riggott Level 6

                        Ok I will see what I can come up with and get back to you. The compensation I get is managing to achieve a good outcome

                        It might be later this evening as I have to go out this afternoon.

                        • 10. Re: Organize a total mess of several thousand jpegs into timestamped folders
                          Paul Riggott Level 6

                          This is a bit rough and ready but should do the job.

                          Copy and paste the script into ExtendScript Toolkit, this program is installed at the same time as Photoshop.

                          This can be found:- C:\Program Files (x86)\Adobe\Adobe Utilities - CS5

                           

                          Run the script, it will open Bridge if it was closed, it will then prompt for two folders.

                          The first folder it wants is the top level folder of the pictures.

                          The second folder is the top level folder where all the new folders will be created and the files moved to.

                          This second folder will also contain an error log of any duplicates or files it can't process.

                          There will be a folder created called noExif and files will be put there if no exif data

                          Once the script is run go for a cup of coffee, the script will give an alert message once finished.

                           

                           

                          #target bridge   
                          app.bringToFront();
                          main();
                          function main(){
                          var folders =[];
                          var topLevel = Folder.selectDialog("Please select top level folder"); 
                          var topLevelOut = Folder.selectDialog("Please select top level output folder"); 
                          var errorLog = File(topLevelOut + "/ErrorLog.txt");
                          errorLog.open("e", "TEXT", "????");
                          errorLog.seek(0,2);
                          $.os.search(/windows/i)  != -1 ? errorLog.lineFeed = 'windows'  : errorLog.lineFeed = 'macintosh';
                          folders = FindAllFolders(topLevel, folders);
                          folders.unshift(topLevel);
                          for(var f in folders){
                          var FileList = folders[f].getFiles(/\.(jpg|jpe|jpeg|gif|eps|dng|bmp|tif|tiff|psd|crw|cr2|rle|dib|cin|dpx|ps|pcd|pict|vda|icb|vst|wbm|sct|pbm|flm|psb|exr|pcx|pdp|nef|dcr|dc2|erf|raf|orf|tga|mrw|mos|srf|pic|pct|pxr|pdd|pef|png|x3f|raw)$/i);
                          for(var z in FileList){
                              var newFolder = getExifDate(FileList[z]);
                              var moveToFolder = Folder(topLevelOut + "/" + newFolder);
                              if(!moveToFolder.exists) moveToFolder.create();
                              var testThumb = File(moveToFolder + "/" + FileList[z].name);
                              if(!testThumb.exists){
                              try{
                              new Thumbnail(FileList[z]).moveTo(moveToFolder);
                              }catch(e){errorLog.writeln("Unable to process :- " + decodeURI(FileList[z])); continue;}
                              }else{
                                  errorLog.writeln(decodeURI(FileList[z]) + " Is a duplicate in " + decodeURI(moveToFolder));
                                  }
                              }
                          }
                          errorLog.close();
                          alert("Script completed");
                          function getExifDate(fileName){
                          if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
                          try{
                          var xmpf = new XMPFile(File(fileName).fsName, XMPConst.FILE_UNKNOWN, XMPConst.OPEN_FOR_READ );
                          }catch(e) {errorLog.writeln("Unable to process :- " + decodeURI(fileName)); return "noExif";}
                          var xmp = xmpf.getXMP();
                          var exifdate = xmp.getProperty(XMPConst.NS_EXIF, "DateTimeOriginal");
                          xmpf.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
                          try{
                          return exifdate.toString().match(/^.{10}/).toString().replace(/-/g,'_');
                          }catch(e){return "noExif";}
                          }
                          function FindAllFolders( srcFolderStr, destArray) {
                           var fileFolderArray = Folder( srcFolderStr ).getFiles();
                           for ( var i = 0; i < fileFolderArray.length; i++ ) {
                            var fileFoldObj = fileFolderArray[i];
                            if ( fileFoldObj instanceof File ) {   
                            } else {
                                   destArray.push( Folder(fileFoldObj) );
                            FindAllFolders( fileFoldObj.toString(), destArray );
                            }
                           }
                           return destArray;
                          };
                          }
                          
                          
                           
                          • 11. Re: Organize a total mess of several thousand jpegs into timestamped folders
                            dutotone Level 1

                            GOOD GOD.

                             

                            I don't even know where to begin saying thanks for this!

                             

                            I tried it for a test run on a folder with 1651/3GB images (about 10% of the total) and it was done in a

                            matter of, i dont know, a total of 20 seconds. I did get an error when it was about 70% done saying Bridge had

                            "stopped working and needed to close" - but I just reran the script on the remaining files in the first folder and

                            it almost instantly completed successfully. Almost all images had EXIF data, only 11 out of all those images ended

                            up in the noexif folder - so this REALLY did the job.

                             

                            I actually am in the process of learning JS so I can appreciate and to some extent understand the code, allthough I

                            would never be able to write this myself. Very interesting to see how the adobe scripting toolkit works and I will definetly

                            spend more time understanding this better.

                             

                            Do you have a home page or a place where you publish scripts like these?

                             

                            By the way, the test run alone on the 1651 files generated 147 dated folders - just to give an idea about how HUGE of a time-saver this is.

                             

                            Now I am gonna process the rest. Again THANKS!

                            • 12. Re: Organize a total mess of several thousand jpegs into timestamped folders
                              Paul Riggott Level 6

                              Glad it's of use, yes I have a place for a few scripts..

                              http://www.scriptsrus.talktalk.net/

                               

                              If you want to learn Photoshop/Bridge scripting another great place is:

                               

                              http://www.ps-scripts.com/bb/

                              • 13. Re: Organize a total mess of several thousand jpegs into timestamped folders
                                dutotone Level 1

                                All done. Neatly organized in 409 folders. Just amazing.

                                 

                                I wasn't fully aware of the range of scripts available from the

                                community for bridge/ps, thank you very much for introducing

                                me to these resources. I'm about to install 'space layers',

                                'layer saver', 'pic processor' and 'distribute layers'! Great time

                                savers, superb.

                                • 14. Re: Organize a total mess of several thousand jpegs into timestamped folders
                                  Jeffko Level 1

                                  Paul,

                                   

                                  This is BRILLIANT. I am using it for recovery from old hard drives as well. Is there a way for the output folders to be 20140807 for instance instead of 2014_08_07 ? One last question, do you have a script that would be a true duplicate finder for a whole hard drive filled with photo's?