Jump to content
Sign in to follow this  
yafreax

where's all the real applescript forums?

Recommended Posts

That is a question i would like answered if you know of them, but i couldn't find one in the last 7 min, so i figured i'd ask you guys if you know of any and go ahead and ask my non-FM-Related applescript question.

DISCLAIMER: I know zero about applescripting, i usually just hit record, do what i need it to do and hit stop.

I'm running a script that copies files from one drive to another, it will run every night (at 2:00 am). no prob there. But after the first run, it now stops with the dialog box "Would you like to overwrite, blah blah blah," message. When i do my trusty "record" action, it doesn't record me saying "yes, overwrite all them old files" it just sits there until i come in the next morning and hit No, b/c it would take to long and screw everything up. Please advise. Probably (hopefully) simple.

Jeremy

Share this post


Link to post
Share on other sites

I would use the duplicate with replacing command as follows:

duplicate(file "file name" of folder "folder name" of "drive name")to folder "destination folder name" of "drive name" with replacing

This should work for you.

Share this post


Link to post
Share on other sites

i get the following error:

"A Replacing:true can't go after this disk Back Up"

this is my current code:

code:

tell application "Finder"

activate

select folder "FileMaker Pro 5 Unlimited"

open selection

select folder "All of the Accounts go in here" of folder "FileMaker Pro 5 Unlimited"

open selection

select every item of container window of folder "All of the Accounts go in here" of folder "FileMaker Pro 5 Unlimited"

copy selection to folder "All of the accounts go in here" of folder "FileMaker Pro 5 Unlimited" of disk "Back Up"

select folder "Web" of folder "FileMaker Pro 5 Unlimited"

open selection

select every item of container window of folder "Web" of folder "FileMaker Pro 5 Unlimited"

copy selection to folder "Web" of folder "FileMaker Pro 5 Unlimited" of disk "Back Up"

end tell


Any ideas?

Jeremy

Share this post


Link to post
Share on other sites

Sometimes parentheses will un-confuse Applescripts:

copy selection to (folder "All of the accounts go in here" of folder "FileMaker Pro 5 Unlimited" of disk "Back Up") with replacing

Or, it may be that the "replacing" option doesn't work with a multi-file copy. You could set up a loop to copy them individually, or...

If you are always overwriting the contents of the backup folder anyway, why not just delete all the contents first before doing the copy. Something like:

delete every item of folder "All of the accounts go in here" of folder "FileMaker Pro 5 Unlimited" of disk "Back Up"

Be very careful with this one though.

Share this post


Link to post
Share on other sites

hmmm, Interesting suggestion about the deleting. If the parentheses dont work i'll test that a few times and i'm sure that would work.

Thanks

Jeremy

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.