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

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to