On 8/2/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > > Mihir Kamdar wrote: > > It has to be ASAP Shawn......but if that's not possible, as a workaround > > we may also look at every half hour or something like that... > > > > do you have any suggestions in mind? > > Well, if I could change anything, I'd change my program to a deamon and > have it listen on a socket. The program that writes these files would, in > addition, request a session with my deamon and send it (via the socket) the > entire file. I would also add to its startup a procedure to cover any > lapses it had between when it last ran and now (optionally, you could turn > this off). > > If you can't do that, then a loop that sleeps every 4 seconds to check and > update if anything new happens. > > 1 + 1 = 1, with rounding > 1 + 1 = 2, with and without rounding > 1 + 1 = 3, with rounding > > The modification times (via touch) has a resolution of +/- 1 second. Any > sleep period of less than 4 seconds have the potential of skipping some > files or repeat some files (depending on how it's coded). > > > -- > Just my 0.00000002 million dollars worth, > Shawn > > "For the things we have to learn before we can do them, we learn by doing > them." > Aristotle > Hi,
@Paul: process_file() would delete the file after processing...it would process the file, write the output to a different directory, and then delete the processed file. But, the way we read files in a directory through readdir, how do we write output of each of the processed files to a different directory. @Rob: After processing each of the files, if we are removing them, then why do we need last access time here. It is guaranteed that any touched file in the child directory is present in the parent directory. We just need to pick that up, process it and remove it from both parent and child directory after processing. But how do we write multiple output files in a different directory. @Shawn: Hey Shawn, the input file will first come into the parent directory, but it will not be a fully written file as soon as it comes. It will still be processed and written by some other program. Only when it is fully written, it is touched into the child directory. So, if we pick up only those files which are touched into child and then remove them after processing, then there should not be an issue with files getting repeated. Thanks, Mihir