8423Re: File system monitoring (for improved upstreaming)
- Aug 4 6:16 AMHello there,
I saw this today on the AppleScript Users list and though that it could
be of interest for the people here. I'm forwarding this also to the
>Date: Fri, 29 Jul 2005 14:55:32 +0200FileNotification.html>
>From: Le Stang Jean-Baptiste <lists@...>
>Subject: Re: [OT] "Message" when file created.
>Cc: AppleScript Users <applescript-users@...>
>> I seem to remember that there's a low level system message created
>> when a file is created. Basically, when a file is created the system
>> notices and does something which can be hooked into by other apps.
>> Does this ring any bells with anyone? If so, can you point me in
>> vaguely the right direction (a starter would be to get the
>> terminology right!).
>I'm not sure this is really the best place to talk about that, but you
>can have a look to 'kqueue(s)', that were introduced in Mac OS X. 3,
>'kqueue(s)' can detect file creation, file modification, and many
>other events related to file I/O. (could be a very good companion to
>folder actions) :
>Here is a nice sample showing what can be done with 'kqueue(s)' :
>This sample includes a detailed PDF report explaining kqueue(s).
>Date: Sun, 31 Jul 2005 19:28:39 -0400
>From: Chris Garaffa <chris@...>
>If you're more comfortable with Cocoa, try Uli Kusterer's UKKQueueAlso, there is a pointer in this thread to this web page and fslogger.
>class: <http://www.zathras.de/programming/sourcecode.htm>. I've used
>it with success, but have never tried calling it from AppleScript
>(you'd have to do that via "call method" in a Studio app).
A File System Change Logger for "Tiger"
>FSLogger is a user-space program for Mac OS X 10.4 "Tiger". It
>subscribes to the same file system event notificatio mechanism as the
>Spotlight metadata server
> Note that fslogger doe not use the Spotlight APIs. It uses the
> mechanism underlying to Spotlight.
>fslogger's mode of operation is very simple. The following points are
>It must be run as root, for example, via the sudo command. This is so
>because subscribing to the kernel's file system change notification
>service requires super-user privileges.
>It takes no useful arguments. You can, however, pass in arbitrary
>arguments that will result in an informational message.
>It does not interfere with the working of Spotlight, since the kernel
>supports multiple such subscribers.
>It will not run on any Mac OS X version older than 10.4.
>Once active, fslogger will wait for change notifications to arrive
>from the file system layer in the kernel. The variou file system
>operations that are communicated to fslogger (and other subscribers
>such as Spotlight, specifically th metadata server) include
>File or folder deletion
>Changes to the stat structure (for example, a permission change)
>Renaming of a file or a folder
>Content exchange between two files
>Finder information changes
>Change of ownership
Emmanuel Décarie / Programmation pour le Web - Programming for the Web
<http://scriptdigital.com/> - Blog: <http://blog.scriptdigital.com> -
- << Previous post in topic Next post in topic >>