Re: How to check whether directory tree has changed?
Re: How to check whether directory tree has changed?
- Subject: Re: How to check whether directory tree has changed?
- From: Sandor Szatmari via Cocoa-dev <email@hidden>
- Date: Sat, 21 Dec 2019 13:50:38 -0500
> On Dec 21, 2019, at 13:43, Jens Alfke <email@hidden> wrote:
>
>
>
>> On Dec 21, 2019, at 10:18 AM, Gabriel Zachmann via Cocoa-dev
>> <email@hidden> wrote:
>>
>> Right. I was hoping there is an easy way to do this.
>> Something like a recursive check sum over the whole directory tree that the
>> OS might keep.
>> I don't want to do a complete tree traversal every time the app launches.
>
> I think you'll need to do it yourself. The FSEvents API isn't going to keep
> an infinitely long history; it certainly won't go back to before the time the
> OS booted.
Yea, the documentation does a good job describing what the circumstances are
that are not covered.
>
> You can shorten the traversal by keeping the mod date of every directory.
> Then if the mod date hasn't changed, you don't need to scan the directory
> contents.
>
> You can keep the data set smaller by keeping only a hash of the collected
> names/mod dates/sizes of the files in each directory. But you do need to keep
> the info for each subdirectory to do the above optimization.
>
> —Jens
_______________________________________________
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