Nansh has asked for the wisdom of the Perl Monks concerning the following question:
#!usr/bin/perl $path='/home/something/something/something'; opendir(DIR,$path) or die"couldnt open the directory\n"; while(readdir(DIR)) { if(-d BUS) { opendir(VEH,"BUS") or die"couldnt open the directory\n"; while(readdir(VEH)) { print "$_\n"; } } }
In this path $path='/home/something/something/something'; many directories are there. say BUS, CAR, LORRY If the directory BUS exists then read that directory and display the files in that directory I am trying but i am not able to get that
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Read Directory
by shmem (Chancellor) on May 26, 2017 at 07:05 UTC | |
|
Re: Read Directory
by Discipulus (Canon) on May 26, 2017 at 07:02 UTC | |
|
Re: Read Directory
by thanos1983 (Parson) on May 26, 2017 at 10:47 UTC | |
|
Re: Read Directory
by Corion (Patriarch) on May 26, 2017 at 06:58 UTC | |
by shmem (Chancellor) on May 26, 2017 at 07:09 UTC | |
by Corion (Patriarch) on May 26, 2017 at 07:12 UTC |