Copy files from one folder to another
I'm using CS4.
As part of my workflow, I output proofs as jpgs from the RAW files then upload them to a website. I run the "Export to jpg" script in Bridge with the option to run a script on completion. The script I'm trying to get working is supposed to copy those jpg files to another folder on my hard drive. I am having problems getting this to copy the files, though. After the "for" line I have tried everything I can think of but cannot seem to make file objects from the array elements contained in jpgs. I thought the array elements were file objects so I tried jpgs
.copy(dst); but it doesn't copy anything. I then tried constructing a new File object from jpgs
.fsName and then using that to try to copy (var proofs=new File(jpgs
.fsName); proofs.copy(dst);).
Everything else works fine and the array jpgs is filled with the files in the referenced folder. If I set up an alert to show the iteration it steps through the file names properly. Can anyone tell me what I'm missing here?
#target "bridge"
var fst= app.document.presentationPath;
var o=new Folder(fst + "/Originals");
var dst=new Folder(fst.replace("Photography","Photoshoots"));
if (!dst.exists) if(confirm(dst.name + " does not exist. Create folder?")) dst.create();if (dst.exists) {
var jpgs=o.getFiles("*.jpg");
for (var p in jpgs) {
jpgs.copy(dst);
}
}
