hey Tom, There is no question of half finished files...because only files that are finished being written will be touched in the child directory. So any touched file in the child directory will have a fully written input file in the parent directory. That's precisely the reason that first I will scan through the child directory and process only those files which are present there... And yeah...as u said..i will use sleep after each processing..
Thanks, Mihir On 8/1/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: > > On 8/1/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > > > There is a parent directory where the input files will be stored. These > > files will keep on coming into the parent directory. > > When you say "keep on coming", what do you mean? Do you mean that > another process is writing these files elsewhere (i.e., in another > directory), and then copying them to this directory at arbitrary > instants? Or is the other program writing them into this directory, > and at any given time there may be a half-finished file mixed in with > the finished ones? How are you prepared to deal with half-finished > files? > > > There is a child > > directory where these input files will just get touched(0 byte files). > > I think you're saying that your program has to create a zero-byte file > in this "child" directory for each file it discovers in the "parent" > directory. > > > I have to read the name of the file from the child directory and then go > to > > the parent directory to process it. > > So now, you're talking about yet another program, which will take its > cues from the program we've been talking about? > > > Only those files in the parent directory > > will be processed which have been touched in the child directory. > > > > Also, these input files will keep on coming from some source. So, my > perl > > file has to run continuously and pick each of the files as they come. > > So, your program will be an infinite loop? I recommend you use the > sleep function so that it will pause for a minute or five between > sweeps. The opendir/readdir/closedir family will come in handy for > checking the files in the directory, and the open and close functions > will suffice for creating the zero-byte files. All of these are > documented in the perlfunc manpage. > > Hope this helps! > > --Tom Phoenix > Stonehenge Perl Training >