directory watching
-
Hy everyone! I know there is a c# operation, to watch a directory for changes, meaning to realize, when files are copied into it to handle them etc. this could be done by filesystemwatcher (FileSystemWatcher watcher = new FileSystemWatcher(); ) but in which order are the files which are found in this directory handled? in alphabetical order or just picking one? so lets say i copy three files to this directory b_file, a_file and c_file in which order are these files handled? and lets say there is already a d_file in it when i start the service watching, which files comes first? because i want to realize a tool which takes the files describing what to do (in xml). so the correct order is important. therefore i have to know the files are handled in the correct order. let's say a_file creates a file, b_file changes the contence and c_file copies it to it's destination. so the "commandfiles" have to be handled in correct order. that's why this info is so important for me. thanks for any hint. stephan.
-
Hy everyone! I know there is a c# operation, to watch a directory for changes, meaning to realize, when files are copied into it to handle them etc. this could be done by filesystemwatcher (FileSystemWatcher watcher = new FileSystemWatcher(); ) but in which order are the files which are found in this directory handled? in alphabetical order or just picking one? so lets say i copy three files to this directory b_file, a_file and c_file in which order are these files handled? and lets say there is already a d_file in it when i start the service watching, which files comes first? because i want to realize a tool which takes the files describing what to do (in xml). so the correct order is important. therefore i have to know the files are handled in the correct order. let's say a_file creates a file, b_file changes the contence and c_file copies it to it's destination. so the "commandfiles" have to be handled in correct order. that's why this info is so important for me. thanks for any hint. stephan.
The files will be handled in the same order as the IO operations. Note you won't get any events for files that were already in the folder before the FileSystemWatcher is started (d_file)
Help me! I'm turning into a grapefruit! Buzzwords!
-
The files will be handled in the same order as the IO operations. Note you won't get any events for files that were already in the folder before the FileSystemWatcher is started (d_file)
Help me! I'm turning into a grapefruit! Buzzwords!
so this means, when a file enters the directory, then the trigger is started. if file a_file and b_file enter at (almost) the same time, is a_file handled first or the one which is first in? to guarantee the correct handling of the files i have to take care, a_file is there before b_file etc. is this correct? because changing contence before creating a file won't work :) or updating data which is not there because the last command should have put the data in there ;) thanks for your info. stephan.
-
so this means, when a file enters the directory, then the trigger is started. if file a_file and b_file enter at (almost) the same time, is a_file handled first or the one which is first in? to guarantee the correct handling of the files i have to take care, a_file is there before b_file etc. is this correct? because changing contence before creating a file won't work :) or updating data which is not there because the last command should have put the data in there ;) thanks for your info. stephan.
stephan_007 wrote:
if file a_file and b_file enter at (almost) the same time, is a_file handled first or the one which is first in?
It handles the first one in first. If the order is important then wait until you get a full set in before starting processing - until you have them all you can't do anything anyway, as far as I can tell from your posting.
Bob Ashfield Consultants Ltd