• 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: Fastest way to check for new files in a folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fastest way to check for new files in a folder


  • Subject: Re: Fastest way to check for new files in a folder
  • From: Ryan Britton <email@hidden>
  • Date: Sun, 14 Jan 2007 21:39:37 -0800

AppKit has nothing that can handle this efficiently. You may be able to achieve this with kqueue, but I have not done this specifically so I can't answer much else. This thread appears to be something along these lines:

http://lists.apple.com/archives/Darwin-development/2004/Feb/ msg00066.html


On Jan 14, 2007, at 9:25 PM, Rick Hoge wrote:


I have an app that needs to poll for new files in a folder that may a large number of files (i.e. thousands).


I have been able to poll for new files using an NSTimer that calls a method that repeatedly returns the entire folder listing (using [[NSFileManager defaultManager] directoryContentsAtPath:[self dataPath]]). This works in principle by looking for files that weren't in the last listing, but seems inefficient when the folder contains 30,000 files (and I have no control over this).

Is there any way to receive a notification when the directory contents change which includes only the files added by the change event? This would be a much better way to go, but I can't find anything in AppKit that does that. Alternately a folder search that uses the file creation time to return only those files that were created since the last poll might work.

Note that the folder I'm trying to monitor is on a Windows machine that my Mac mounts via Samba. The Windows machine is the host for a data acquisition system and I can't modify it. I seem to recall that Spotlight might be able to index files on a network mounted hard drive, but not sure if this will work over Samba. I'm not expecting to be able to use Spotlight, but if there are any opportunities I'm ignoring it would be great to find out.

Thanks for any suggestions -

Rick


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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)

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


References: 
 >Fastest way to check for new files in a folder (From: Rick Hoge <email@hidden>)

  • Prev by Date: Fastest way to check for new files in a folder
  • Next by Date: Re: Fastest way to check for new files in a folder
  • Previous by thread: Fastest way to check for new files in a folder
  • Next by thread: Re: Fastest way to check for new files in a folder
  • Index(es):
    • Date
    • Thread