For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > September 2006 > Reading multiple files









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Reading multiple files
hshirani@gmail.com

2006-09-09, 3:57 am

Hi,

I want to read all the files within a directory assuming that I do not
know the name of the files beforehand. Is there any way to do it ?

Thanks.

Paul Lalli

2006-09-09, 3:57 am

hshirani@gmail.com wrote:
> I want to read all the files within a directory assuming that I do not
> know the name of the files beforehand. Is there any way to do it ?


Yes.

Open the directory, read the list of files. For each file read, open
that file and read it.

perldoc -f opendir
perldoc -f readdir

You will also want to make sure the directory entry is actually a file.

perldoc -f -X

Paul Lalli

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com