@willcampbell7
Thanks, it’s probably possible with a variation on the method shown by @Lumigraphics here:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/exiftool-integration-script-available/m-p/13659926
Where the command line program ExifTool is called and has parameters passed. I'm guessing that one would just use platform-specific calls rather than ExifTool. Not sure about passing in the variables for the file and folder though... They could probably be hard-coded though if nothing else.
Yup just had to sleep on it. Photoshop has the app method "system". Sends Terminal commands on Mac, Command Prompt on Windows. So a few tweaks. One thing different is you don't pass file objects. Instead just String objects of the full paths. And now the destination includes the file name, not just the folder. An added benefit of this difference is that the file can be renamed when moved. If not just have the same name in the "to" argument, as my example call at top shows. Also this won't deal with dotbar files on a Windows server. Those files rare nowadays anyway. That was old leftover stuff from 10 years ago, still in my first sample code I posted. Hardly anyone needs that anymore.
var from = "~/Desktop/in folder/green.jpg";
var to = "~/Desktop/out folder/green.jpg";
var result = moveFile(from, to);
alert(result);
function moveFile(from, to) {
// from = String: full path and name of file to move.
// to = String: full path and name of new file at destination.
var command;
var fileFrom;
var fileTo;
var folderTo;
fileFrom = new File(new File(from).fsName);
fileTo = new File(new File(to).fsName);
if (/%(?!20|5C)/.test(File.encode(fileFrom.fsName))) {
// Unicode characters detected in filename. Move will fail because
// ExtendScript cannot pass Unicode text to command prompt via a string variable.
return false;
}
if (!fileTo.exists) {
folderTo = new Folder(fileTo.path);
if (!folderTo.exists) {
folderTo.create();
}
if (File.fs == "Windows") {
command = "move \"" + fileFrom.fsName + "\" \"" + fileTo.fsName + "\"";
app.system(command);
} else if (File.fs == "Macintosh") {
command = "mv \"" + fileFrom.fsName + "\" \"" + fileTo.fsName + "\"";
app.system(command);
}
if (fileTo.exists) {
return true;
}
}
// Failed to move.
return false;
}