Not as easy as it would seem.
You have to start a new epoch, wait for a specific period,
then read
your epoch evnts, and search for a event 1 (Directory
create) or an
event 4 (File create).
If the event matches your directory, then launch the PL file
you need.
Then you have to tear down your epoch, and set up a new one.
And then do it all over again.
It is not a small feat, and you have to consult the VFS NDK.
I know you have used the VFS system before, so you know how
to call
and read the XML files.
So to give you a few pointers, take a look at these
functions in the
VFS NDK chapter 5:
startEventEpoch, stopEventEpoch, listFileEvents,
resetEventList,
removeEventEpoch and listFileEvents.
When you make an epoch, you are handed a epoch number, this
number is
used to access the event from then on. So wait some time,
stop the
event, and read it out with listFileEvents. The [ACTION] tag
will tell
you if it was a file create event:
1: Dir create
2: File/Dir Delete
3: Save
3/4: Copy
4: File create
5: File/Dir Rename
Keep in mind that this list is not complete, as it tends to
change
from SP to SP, and from OS type (NBO bokses are quite
different)
I hope that was helpful, I can't hand the code to you, due
to
copyright issues, but give it a go, and write out the XML
results to a
file, so you have an idea about the result structure.
Things to watch out for:
Getting the wrong epoch number from a create (0 is not
valid).
Checking the XML result codes (there is one for the request
it self,
and one for the VFS result).
When going from one epoch to another, you have a small gap
where
anything can happen.
Do not just let it run without a pause, you will slow the
filesystem
down.
Beshure that you read ALL of the XML result. Better to read
too much,
than too little. Perl doesn't mind if you request a block
of bytes
that is bigger than the physical size left in the file
(hint: there is
an error in the documentation here - read my earlier post on
the
subject).
But when it runs, the VFS system is remarkably reliable.
I've tested
it on 20.000 different continous file operations. It
recorded every
single one of them.
Regards
Allan
On Thu, 27 Apr 2006 16:42:35 GMT, Serg <skoltogyan mail.ru> wrote:
>Any body have example - how run perl script for the
specific VFS EVENT ?
>
>Example: when in the folder vol1:\vol\dir\ddd
created file - VFS automate
>run perl script: sys:\perl\scripts\s.pl
>
>Serg
>?
|