• 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
Re: How to check whether directory tree has changed?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to check whether directory tree has changed?


  • Subject: Re: How to check whether directory tree has changed?
  • From: Jens Alfke via Cocoa-dev <email@hidden>
  • Date: Sat, 21 Dec 2019 10:43:11 -0800


> 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.

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

  • Follow-Ups:
    • Re: How to check whether directory tree has changed?
      • From: Sandor Szatmari via Cocoa-dev <email@hidden>
References: 
 >Re: How to check whether directory tree has changed? (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)
 >Re: How to check whether directory tree has changed? (From: Sandor Szatmari via Cocoa-dev <email@hidden>)
 >Re: How to check whether directory tree has changed? (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)

  • Prev by Date: Re: How to check whether directory tree has changed?
  • Next by Date: Re: How to check whether directory tree has changed?
  • Previous by thread: Re: How to check whether directory tree has changed?
  • Next by thread: Re: How to check whether directory tree has changed?
  • Index(es):
    • Date
    • Thread