Re: Automatically mirroring folders
Re: Automatically mirroring folders
- Subject: Re: Automatically mirroring folders
- From: Matt Gough <email@hidden>
- Date: Mon, 20 Jun 2011 08:53:40 +0100
Can you not make use of:
kFSEventStreamCreateFlagIgnoreSelf
"Ignore events generated by this client. For example, an application might want to watch for changes to a file so that it can reread it, but should not needlessly reread it if the change to the file was caused by the application itself writing out changes."
Matt
On 19 Jun 2011, at 17:48:32, Leonardo wrote:
> Problem: I have to automatically mirror 2 folders, /A and /B, such a way
> they contains the same files and folders.
>
> - So I FSEventStreamCreate with kFSEventStreamEventIdSinceNow,
> kFSEventStreamCreateFlagWatchRoot and a 2 seconds latency time.
>
> - I get a notification: there is a new file to copy from /A to /B. I copy
> the file, but I quickly get a new notification that there is a new file in
> B. Well, this notification is useless to me. I copied that file. Therefore I
> don't need to copy it again.
>
> - So, before I copy the file, I thought, I stop and invalidate the stream,
> then I copy the file, then I turn the stream on again. But here I get 2
> problems:
>
> 1) At the end of the copyFile, I turn the stream on again, and the Finder, a
> couple of seconds later (but it could even be shorter or longer) updates the
> /B/.DS_Store file so I get a new notification. How to force the Finder to
> update the .DS_Store file immediately after the copy? Or should I use a
> longer latency time? How long?
>
> 2) During the period of time the stream is off, if some new files arrive
> within the folder /A, I lose the notification to copy it.
>
> How to workaround that?
>
>
> Regards
> -- Leonardo
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden