FW: Overwrite file copying
FW: Overwrite file copying
- Subject: FW: Overwrite file copying
- From: steve <email@hidden>
- Date: Thu, 04 Jan 2001 12:26:04 -0800
Steve,
this will work nicely:
tell application "Finder"
try
duplicate file "Macintosh HD:Desktop Folder:010103.txt" to folder
"Macintosh HD:Desktop Folder:AStest"
on error
display dialog "A file already exists with that name" & return &
return & "Do you want to replace the file that exists?" buttons {"yes",
"no"}
if button returned of result is "yes" then
duplicate file "Macintosh HD:Desktop Folder:010103.txt" to
folder "Macintosh HD:Desktop Folder:AStest" with replacing
end if
end try
end tell
--
Steve Kump
New Media Development
BC Newsgroup
34375 Cyril Street
Abbotsford, BC
Canada
(604)870-4520
email@hidden
>
From: "Stephen Gross" <email@hidden>
>
Organization: Stuart Country Day School
>
Date: Thu, 4 Jan 2001 11:03:43 -0800
>
To: email@hidden
>
Subject: Overwrite file copying
>
>
I know how to do a file copy. How do I do a file overwrite? Also, can I
>
enclose it in a try block, and catch the "file already exists" error. Here's
>
kind of what I have in mind:
>
>
try
>
copy file1 to location1
>
catch (file already exists) error
>
query user for overwrite
>
end try
>
>
Thanks!
>
--Steve
>
_______________________________________________
>
applescript-users mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/applescript-users