Re: Watched Folders
Re: Watched Folders
- Subject: Re: Watched Folders
- From: Andrew Oliver <email@hidden>
- Date: Tue, 22 Jul 2003 10:27:32 -0700
Your problem is that you're calling 'list folder' to get the folder's
contents. This will, of course, include all existing files in that folder.
Instead, use the list of files that are passed into your handler.
In the case of:
on adding folder items to this_folder after receiving these_items
"these_items" is the list of files that have just been added. If you change
your upload line to reference 'these_items' rather than the results of the
list folder command, you'll be all set.
So, instead of:
repeat with myitem in myFolderItems
use:
repeat with myitem in these_items
Andrew
:)
On 7/22/03 9:49 AM, "Chad Lindsey" <email@hidden> wrote:
>
I am creating a watched folder script that uploads files to a FTP directory.
>
The problem I am having is once a file hits the folder, it uploads, while
>
doing so other files are added into the folder. The problem is it starts
>
over and re-uploads the same files over and over until no other files have
>
landed in the watched folder. Any ideas?
>
>
on adding folder items to this_folder after receiving these_items
>
with timeout of 300 seconds
>
set myUser to "xxxx"
>
set myPassword to "xxxx"
>
set myHost to "xxxx"
>
set myDirectory to "/home/xxx/"
>
set myurl to "ftp://" & myUser & ":" & myPassword & "@" & myHost &
>
"/" & myDirectory
>
set myFolder to "Mac15:Users:chadlindsey_epp3:Desktop:Pitstop
>
Server:Processed Docs on Success:"
>
tell application "Fetch 4.0.3"
>
with timeout of 300 seconds
>
open url myurl
>
end timeout
>
end tell
>
>
tell application "Finder"
>
set myFolderItems to list folder alias ,
>
myFolder without invisibles
>
>
repeat with myitem in myFolderItems
>
try
>
tell application "Fetch 4.0.3" to set ,
>
myRemoteDate to modification date of remote item
>
myitem
>
set myExistFlag to true
>
on error
>
set myExistFlag to false
>
end try
>
if kind of alias (myFolder & myitem) is not ,
>
"folder" then
>
if myExistFlag then
>
tell application "Finder" to set myLocalDate ,
>
to modification date of alias (sourceFolder ,
>
& myitem)
>
set myUploadFlag to (myRemoteDate < myLocalDate)
>
else
>
set myUploadFlag to true
>
end if
>
if myUploadFlag then
>
with timeout of 300 seconds
>
tell application "Fetch 4.0.3" to put into
>
transfer window 1 item alias ,
>
(myFolder & myitem)
>
end timeout
>
end if
>
end if
>
end repeat
>
--end repeat
>
end tell
>
end timeout
>
end adding folder items to
>
>
Thanks, Chad
>
_______________________________________________
>
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.
_______________________________________________
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.