Skip to main content
Participating Frequently
August 23, 2006
Question

How to copy an image to another folder?

  • August 23, 2006
  • 1 reply
  • 440 views
I am sure that there is a very simple answer to this question, but I have not been able to find anything in the Adobe Javascript documentation on how to copy an image!

I have a script that takes a series of selected thumbnails and generates a string that has the "destination" filename and path based on the EXIF date (e.g. NameString = "C:\\Photos\\2006\\2006-08-23\\image01.jpg").

What I would like to do now is to copy the selected image to this new path and filename. The folders may or may not exist. Here is an excerpt from my code:

var ImageName = decodeURI(thumb.spec.name);
var NewPath = DestPath + "\\" + YearString + "\\" + YearString + "-" + MonthString + "-" + DayString + "\\";
var DestinationFolder = new Thumbnail(Folder(NewPath));
var DestinationImage = new Thumbnail(File(NewPath+ImageName));
thumb.copyTo(DestinationImage);

Any suggestions are welcome.

Regards, Nigel
This topic has been closed for replies.

1 reply

Participating Frequently
August 28, 2006
Hi Nigel,

are you looking for this snipplet?

if(!DestinationFolder.exists)
DestinationFolder.create();

markus