Photoshop: How do I save the same image in multiple locations at the same time?

  • 1
  • Question
  • Updated 4 years ago
  • (Edited)
Is there a way to save a file in multiple locations at the same time i.e. once I've finished editing an image, I would like the ability to save my file to a few different folders at one time. For instance one to a backup folder, one to a portfolio folder one to an ftp folder and one to my colleagues. This would probably save me a few seconds or a minute at most but when you multiply that by 30 pictures everyday five days a week it adds up! Surely this should be relatively easy for you Photoshop geniuses?
Photo of Dermot Doorly

Dermot Doorly

  • 2 Posts
  • 0 Reply Likes

Posted 4 years ago

  • 1
Photo of christoph pfaffenbichler

christoph pfaffenbichler, Champion

  • 1225 Posts
  • 172 Reply Likes
Actions might be able to handle that, but I would prefer a Scripting approach to such a task.
Photo of Dermot Doorly

Dermot Doorly

  • 2 Posts
  • 0 Reply Likes
Actions would only make it possible to save it to set locations (if it's possible - will look into that , thanks for suggestion) but ideally in the save option you could just choose as many folders as you wanted and select which folders with the last folders you saved in being the default, then if you want to change one you can simply change it (a menu similar to the batch rename in bridge is what I'm thinking)
Photo of christoph pfaffenbichler

christoph pfaffenbichler, Champion

  • 1210 Posts
  • 166 Reply Likes
If you want to give it a try, paste the following text into a new file in ExtendScript Toolkit or a text editor and save it as a jsx-file into Photoshop’s Presets/Scripts-folder.
After restarting Photoshop the Script should be available under File > Scripts.

// save file, then copy it to folders;
// 2015, use it at your own risk;
#target "photoshop-70.032"
if (app.documents.length > 0) {
//////////////////////////////////////////
// check for prefs-file;
var thePref = File($.fileName).parent.fullName+"/copySavedFileToFoldersPref.txt";
if (File(thePref).exists == true) {
var theStoredInfo = readPref(thePref).split("\r");
}
else {
var theStoredInfo = []
};
//////////////////////////////////////////
var myDocument = app.activeDocument;
var docName = myDocument.name;
try {
var basename = docName.match(/(.*)\.[^\.]+$/)[1];
var docPath = myDocument.path;
}
catch (e) {
var basename = myDocument.name;
var docPath = "~/Desktop"
};
//////////////////////////////////////////
////// create dialog for customer-entry //////
var dlg = new Window('dialog', "save copies to", [500,300,820,713]);
dlg.filename = dlg.add('statictext', [12,15,308,35], (docPath), {multiline:false});
//////////////////////////////
dlg.addButton = dlg.add('button', [12,45,308,80], "add folder");
dlg.addButton.onClick = function () {
var theFolder = Folder(docPath).selectDlg ("select folder");
if (theFolder) {
dlg.thepath.add("item", Folder(theFolder).fullName);
dlg.thepath.selection = dlg.thepath.items[0];
}
};
//////////////////////////////
dlg.thepath = dlg.add('listbox', [12,90,308,340]);
// populate;
for (var o = 0; o < theStoredInfo.length; o++) {
if (Folder(theStoredInfo[o]).exists == true) {
dlg.thepath.add("item", theStoredInfo[o])
}
};
dlg.thepath.onClick = addFolder;
// what to do when clicked;
function addFolder () {
// remove if shift key is pressed;
if (ScriptUI.environment.keyboardState.shiftKey == true) {
for (var n = this.items.length - 1; n >= 0; n--) {
if (this.items[n].selected == true) {this.remove(this.items[n])};
}
return
};
// otherwise;
var theFolder = Folder(docPath).selectDlg ("select folder");
if (theFolder) {
for (var n = 0; n < this.items.length; n++) {
if (this.items[n].selected == true) {this.items[n].text = String(theFolder.fullName)};
}
};
};
//////////////////////////////
// cancel-button;
dlg.okAndCancel = dlg.add('panel', [12,350,308,405]);
dlg.okAndCancel.okBtn = dlg.okAndCancel.add('button', [10,10,141,40], 'OK', {name:'ok'});
dlg.okAndCancel.cancelBtn = dlg.okAndCancel.add('button', [149,10,280,40], 'Cancel', {name:'cancel'});
//////////////////////////////
dlg.center();
var myReturn = dlg.show ();
if (myReturn == 1) {
// save file;
try {myDocument.save()}
catch (e) {
psdOpts = new PhotoshopSaveOptions();
psdOpts.embedColorProfile = true;
psdOpts.alphaChannels = true;
psdOpts.layers = true;
psdOpts.spotColors = true;
myDocument.saveAs(File(docPath+"/"+basename+".psd",psdOpts,false))
};
// collect folders for pref;
var theFolder = new Array;
// copy file to folders;
for (var m = 0; m < dlg.thepath.items.length; m++) {
var thisFolder = dlg.thepath.items[m].text;
copyFile (myDocument, thisFolder);
theFolder.push(thisFolder)
};
// create the prefs-file;
writePref (theFolder.join("\r"), thePref);
};
};
//////////////////////////////
//////////////////////////////
//////////////////////////////
////// copy file //////
function copyFile (myDocument, thisFolder) {
var theFile = File(thisFolder+"/"+myDocument.name);
if (File(theFile).exists == true) {
var theConfirm = confirm ("replace existing file \n"+theFile+"\n?");
if (theConfirm == false) {return}
};
File(myDocument.fullName).copy(File(theFile))
};
////// read prefs file //////
function readPref (thePath) {
if (File(thePath).exists == true) {
var file = File(thePath);
file.open("r");
file.encoding= 'BINARY';
var theText = new String;
for (var m = 0; m < file.length; m ++) {
theText = theText.concat(file.readch());
};
file.close();
return String(theText)
}
};
////// function to write a preference-file storing a text //////
function writePref (theText, thePath) {
try {
var thePrefFile = new File(thePath);
thePrefFile.open("w");
for (var m = 0; m < theText.length; m ++) {
thePrefFile.write(theText[m])
};
thePrefFile.close()
}
catch (e) {};
};
Photo of christoph pfaffenbichler

christoph pfaffenbichler, Champion

  • 1225 Posts
  • 172 Reply Likes
If you want those Folders to be remembered across iterations you need some way to store that information, either a preferences file or a custom namespace in Photoshop would be possibilities.
But for a Photoshop Scripting beginner’s project it may be a bit much.

If you need help or advice on Photoshop Scripting you could post over at
https://forums.adobe.com/community/ph...
and/or
http://ps-scripts.com/bb/