Re: Copying files via applescript
Re: Copying files via applescript
- Subject: Re: Copying files via applescript
- From: Graff <email@hidden>
- Date: Wed, 09 Jun 2004 15:06:11 -0400
Try this:
----
tell application "Finder"
-- change these variables to point to whatever folders you want
set labsFolder to (path to documents folder as string) & "labs"
set destFolder to "LEXAR_MEDIA:JavaProgs:labs:"
try
if (folder labsFolder exists) then
if (folder destFolder exists) then
repeat with i from 1 to count of items of folder labsFolder
set theItem to item i of folder labsFolder
set checkFile to (destFolder as string) & (name of theItem)
if ((file checkFile) exists) then
if ((modification date of file checkFile) is less than
(modification date of theItem)) then
duplicate theItem to folder destFolder
else
display dialog "There is already a current version of the
file \"" & name of theItem & "\" in the folder."
end if
else
duplicate theItem to folder destFolder
end if
end repeat
else
display dialog "The folder \"" & destFolder & "\" does not
exist."
end if
else
display dialog "The folder \"" & labsFolder & "\" does not exist."
end if
on error
display dialog "An error occured. Unable to complete the backup"
end try
end tell
----
Be careful of the long lines, sometimes they get wrapped wrong in
e-mails. If this is a problem then e-mail me directly and I'll send an
attached copy of the script directly to you.
- Ken
On Jun 9, 2004, at 12:41 PM, Brian Dent wrote:
I am trying to make an applescript to copy all the files in a folder
to a USB memory card. and if the file already exists on the card to
keep which ever version is most current.
so far i have.
tell application "Finder"
activate
set labsFolder to folder "labs" of folder "JavaProgs" of folder
"Documents" of folder "KushelDuv" of folder "Users" of startup disk
set destFolder to folder "labs" of folder "JavaProgs" of disk
"LEXAR_MEDIA"
duplicate labsFolder to destFolder
end tell
but how do i get it to keep the most recent?
one other question this script runs fine but if i change both "labs"
to "assignments" it opens up the little copying window, copies the
files, but then says there was an error. and when i look at the memory
card nothing was copied. any idea wutz happenin?
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.