Copying a file to a new folder

I have a Filemaker Pro file that lists image files (jpeg’s) using the file address. Each record in the Filemaker file has an address of the image like this:

<file://Macintosh HD/Users/Jake/Documents/Web Sites/sdia-images/Images for uploading/Congo/Albadi School and Orphanage/Albadi_School-2010-img_2148.jpg>

I want to make folders with only the good images (there are a lot of not-so-good ones) I am hoping that I can use this address to copy the specified images into new folders.

I want a script that will allow me to make a copy of an image that is in the original folder in another folder using the AppleScript step in a FileMaker Script. I am sure this is a very standard bit of AppleScripting. Does anyone know where I could find such a script?


Jake Sterling

I suppose the trick here is if filemaker can set the name of the folder/file as a variable. if you can get that, set the script to make copies that way:

Set origFolder to "Users:yourname:Desktop:" -- or to a variable that is set by filemaker 
Set newFolder to "Path:to:the:new:Folder"

  duplicate every file of origFolder to folder newFolder

By default, the duplicate command will not automatically replace existing items in the destination location with the same name. If you want to replace existing items in any situation, then you can simply use the replacing parameter to indicate that any existing items should be replaced, if necessary. For example:

Set origFolder to "Users:yourname:Desktop:"
Set newFolder to "Path:to:the:new:Folder"

  duplicate every file of origFolder to folder newFolder
replacing true

Thanks Billie

I had posted that inquiry quite a while ago and have solved the problem. The thing I hadn’t understood was that, in Applescript, filepaths are written out backwards, e.g. ‘document file “file.jpg” of folder “Image file” of folder “Documents” of folder blah blah blah.’ I had been trying to use the regular style of filepath and was getting nothing but error messages.

What I finally did was to create a variable in which the filepath was turned into a value list and then put it back together in the Applescript format. I am not sure I like applescript!