• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Watched Folders
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Watched Folders


  • Subject: Watched Folders
  • From: Chad Lindsey <email@hidden>
  • Date: Tue, 22 Jul 2003 12:49:23 -0400

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.

  • Follow-Ups:
    • Re: Watched Folders
      • From: Andrew Oliver <email@hidden>
  • Prev by Date: Re: What to make of the "AppleScript Experience"
  • Next by Date: Re: Watched Folders
  • Previous by thread: Re: Apple mail : save attached file
  • Next by thread: Re: Watched Folders
  • Index(es):
    • Date
    • Thread