On Jul 13, 2004, at 8:31 AM, [EMAIL PROTECTED] wrote:

Greetings,

Howdy.

Would someone be kind enough to point me in the right direction to solve this
problem?

I'll sure try.

An application creates XML files in a subdirectory, which I then convert to
EDI. That part is now working fine. My problem is that the application
creates files during the day, with slightly different names. For example:


File0001.xml
File0002.xml
File0244.xml

We can sure make a regex for that, right?

m/^File\d+\.xml$/

The file names vary based on what part of the application creates them.
There seems to be no pattern of the number after the alpha characters. I need to
read each of these files, and concatenate them into a single EDI file.

Do you know how to read the listing of files in a directory? Three steps:


opendir DIR, 'path/to/dir' or die "Directory error:  $!";  # open dir

my @files = grep m/^File\d+\.xml$/, readdir DIR; # get file listing using earlier regex

closedir DIR; # clean up after ourselves, as all good programmers should

# loop over @files down here...

The only files in the subdirectory need to be processed; and all of the files in
the subdirectory need to be processed.

Was that line English? <laughs> You lost me here. If I haven't solved your problem yet, try me again on this part.


Could someone point me in the right direction?

Hope that helps.

James


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




Reply via email to