Hi all
This is a bit vague I suppose :-) Tomorrow I need to write a service which
monitors two folders for new files and performs tasks appropriately. Some
of these tasks are not too intensive and some are. Here's a scenario
Event: \Incoming\SomeF ile.txt
Action: Copy to a backup folder. Move it elsewhere
Event: \Incoming\SomeF ile.zip
Action: Copy to a backup folder. Unzip a file within it elsewhere
Event: \Outgoing\SomeF ile.txt
Action: Copy to a backup folder. Move it elsewhere
Event: \Outgoing\SomeF ile.xml
Action: Parse the XML, generate a binary file, zip the binary file, backup
the zip file, copy the zip elsewhere.
In most of these cases the task is quick, in the final case the task could
take up to a couple of minutes. I really need to look into this in great
detail in the morning, but I am hoping to get a bit of a head-start :-)
01: Is there a class for monitoring new files in a folder and triggering an
event or something with the name of the new file?
02: I expect that once the event triggers I will stuff the filename into a
thread-safe queue. If I have a thread pool for the quick tasks and queue
tasks to perform I presume the thread automatically sleeps again once the
task is complete, is that right?
Thanks
Pete
This is a bit vague I suppose :-) Tomorrow I need to write a service which
monitors two folders for new files and performs tasks appropriately. Some
of these tasks are not too intensive and some are. Here's a scenario
Event: \Incoming\SomeF ile.txt
Action: Copy to a backup folder. Move it elsewhere
Event: \Incoming\SomeF ile.zip
Action: Copy to a backup folder. Unzip a file within it elsewhere
Event: \Outgoing\SomeF ile.txt
Action: Copy to a backup folder. Move it elsewhere
Event: \Outgoing\SomeF ile.xml
Action: Parse the XML, generate a binary file, zip the binary file, backup
the zip file, copy the zip elsewhere.
In most of these cases the task is quick, in the final case the task could
take up to a couple of minutes. I really need to look into this in great
detail in the morning, but I am hoping to get a bit of a head-start :-)
01: Is there a class for monitoring new files in a folder and triggering an
event or something with the name of the new file?
02: I expect that once the event triggers I will stuff the filename into a
thread-safe queue. If I have a thread pool for the quick tasks and queue
tasks to perform I presume the thread automatically sleeps again once the
task is complete, is that right?
Thanks
Pete
Comment