[Perl] How to get subdirectory?

Status
Not open for further replies.

maulin sheth

Advanced Member level 2
Joined
Oct 24, 2010
Messages
502
Helped
90
Reputation
179
Reaction score
90
Trophy points
1,318
Location
Bangalore, India
Visit site
Activity points
4,161
Hello All,

Can any one please help me to how to get the full path of sub directory using perl?
e.g. if directory structure like :

|-- a
| |-- b
| | |-- c
| | | `-- test.tcl
| | |-- d
| | | `-- test.tcl
| | `-- e
| | `-- f
| | `-- test.tcl
| `-- g
| `-- test.tcl

Perl output is :
a/b/c
a/b/d
a/b/e/f
a/g
--
Thanks & Regards,
Maulin Sheth
 

You can use find to check all the sub directories :
find ./* -iname "*" -> Will display each and everything from the parent direcotory

Then you can pipe it to have only folder (-f).

Edit:
You can use tree in terminal (SHELL) just to verify with perl coding.
 
Last edited:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…