Re: Fastest way to check for new files in a folder
Re: Fastest way to check for new files in a folder
- Subject: Re: Fastest way to check for new files in a folder
- From: "Bruce Johnson" <email@hidden>
- Date: Sun, 14 Jan 2007 21:41:04 -0800
I've good luck with Uli Kusterer's UKKQueue (http://www.zathras.de) I
don't think that this works on remote file systems, it might on Samba,
I haven't tried. There are also some good tools using launchd, but
again I don't about the Samba file system situation. If these work
with Samba, then I would recommend these choices.
My methodology on NFS mounts is to create a timer that polls the
directory in question. On launch I create a structured array of the
initial contents and then monitor any changes that occurs after that
point. Like yourself I'm monitoring thousands of image files.
On 1/14/07, Rick Hoge <email@hidden> 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
--
----
Bruce Johnson
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