Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a directory containing many new directories all of which contain a file called 'mlc'. I want to be able to read the contents of each 'mlc' file from all directories (115) from with a perl script.
Is this possible? I also want to be able to relate the contents of each file to the name of the directory that it came from.
As there are so many directories I really don't want to hard code it.
All I have so far is listing the files in the directory 'new'.
'new' then contains the 115 directories all containing a file 'mlc' (which all have different contents). All of the directories within new are named the same apart from a number at the end, e.g. dir0 -> dir114
opendir (NEW, "new/") or die "unable to open directory new $!"; my @dir_files = readdir(NEW); print "@dir_files\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: opening directories in perl
by adrianh (Chancellor) on Jul 03, 2005 at 20:33 UTC | |
|
Re: opening directories in perl
by TedPride (Priest) on Jul 03, 2005 at 19:35 UTC | |
|
Re: opening directories in perl
by mifflin (Curate) on Jul 03, 2005 at 18:33 UTC | |
|
Re: opening directories in perl
by trammell (Priest) on Jul 03, 2005 at 18:33 UTC | |
by Anonymous Monk on Jul 03, 2005 at 19:24 UTC | |
by trammell (Priest) on Jul 03, 2005 at 19:50 UTC |