Automatically mirroring folders
Automatically mirroring folders
- Subject: Automatically mirroring folders
- From: Leonardo <email@hidden>
- Date: Sun, 19 Jun 2011 18:48:32 +0200
- Thread-topic: Automatically mirroring folders
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