Re: Monitor Folder For Changes
Re: Monitor Folder For Changes
- Subject: Re: Monitor Folder For Changes
- From: Jeffrey Mattox <email@hidden>
- Date: Wed, 18 Dec 2002 17:36:00 -0600
I am trying to write a script which will monitor a folder and copy
any files which are newly added or updated to another location. So
far, I have a folder action script which launches when a file is
added to the folder. I check the creation date of files in the
folder and copy recently-created files to another folder.
The problem is this:
the files are very large so they take a minute or two to copy.
During this time, another file or files might be added to the
folder, in which case they are ignored by my script once it is done
copying. Is there some way I can avoid missing any changes to the
folder as far as new/updated files? I'm hoping someone has a
ready-made script which does just this, since it seems like a
generally useful tool.
FWW
You could just loop back to the beginning and repeat your test, doing
that until there is no more work to do.
Here's some pseudo code:
set didWork to true
repeat while (didWork is true)
set didWork to false
repeat with theFile in (every file of thefolder)
if ( theFile is new ) then
-- copy the new file here
set didWork to true
end if
end repeat
end repeat
Jeff
_______________________________________________
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.