Skip to main content
Participating Frequently
November 27, 2013
Question

Saving multiple images at one time to a different folder

  • November 27, 2013
  • 2 replies
  • 1257 views

Is there a script available that can save multiple pictures upon completion of editing to a different output folder of my choice other than the source folder all at the same time? Example I open 11 different photos from source folder x, I edit said 11 pictures and now want to save all 11 pictures to output folder xy all at the same time.  What I want to prevent is having to click save as select new folder for each and every picture I have open.

This topic has been closed for replies.

2 replies

c.pfaffenbichler
Community Expert
Community Expert
November 28, 2013

Does this help?

/* save open documents to location */

/* 2013, use it at your own risk */

if (app.documents.length > 0) {

          var myDocument = app.activeDocument;

/* create dialog */

          var dlg = new Window('dialog', "select files", [500,300,830,565]);

/*create list of open files, thanks to paul r */

dlg.fileList = dlg.add('listbox', [15,15,315,220], 'field', {multiselect: true});

/* populate the list with the open files’ names */

for (var o = 0; o < app.documents.length; o++) {

          dlg.fileList.add ("item", app.documents.name);

          dlg.fileList.items.selected = true

          };

/* buttons for ok, and cancel */

          dlg.buildBtn = dlg.add('button', [13,230,160,255], 'OK', {name:'ok'});

          dlg.cancelBtn = dlg.add('button', [170,230,317,255], 'Cancel', {name:'cancel'});

          dlg.center();

/* show the window */

          var myReturn = dlg.show ();

          if (myReturn == true) {

/* get the selcted ones */

          var theSelected = new Array;

          for (var p = 0; p < dlg.fileList.items.length; p++) {

                    if (dlg.fileList.items

.selected == true) {

                              theSelected = theSelected.concat(app.documents

)

                              }

                    };

/* folder selection */

          var theFolder = Folder.selectDialog("select a folder");

          if (theFolder) {

                    var thePath = theFolder.fullName;

                    psdOpts = new PhotoshopSaveOptions();

                    psdOpts.embedColorProfile = true;

                    psdOpts.alphaChannels = true;

                    psdOpts.layers = true;

                    psdOpts.spotColors = true;

/* save the psds */

                    for (var m = 0; m < theSelected.length; m++) {

                              app.activeDocument = theSelected;

                              var theDoc = app.activeDocument;

                              try {var basename = theDoc.name.match(/(.*)\.[^\.]+$/)[1]}

                              catch (e) {var basename = theDoc.name};

                              if (File(thePath+'/'+basename+".psd").exists == false) {

                                        theDoc.saveAs((new File(thePath+'/'+basename+".psd")),psdOpts,false);

  theDoc.close()

                                        }

                              else {alert ("a file named "+basename+".psd"+" already exists in that folder")}

                              }

                    }

          }

};

Participating Frequently
November 28, 2013

c.pfaffenbichler

Thank you very much for your response, but I have to be honest with you and say wow that blew my mind and I have no idea what it does or how to incorporate it as I am still learning things. But thank you very much

Participating Frequently
November 28, 2013

In case it's important I'm running PS on a Mac

Inspiring
November 27, 2013

What version of Photoshop are you using? Newer versions have a preference for 'Save as to original folder'. With that preference off you will not have to keep choosing the new folder.

Participating Frequently
November 27, 2013

I'm using Photoshop CS5. What I want is to be able to close all open pictures and save them all at once to a folder of my choosing. I don't want to save to the original source folder as I want the original to be untouched. Does this make sense.