How to read directory contents

0

Hi All,

Is there a way to read directory recursively and its contents? Below sample example can provide more details on my objective.

Directory : /opt/opennms/share/rrd/snmp/2 , following directories are created

ls -DR umOrgIndex/

umOrgIndex/:
0  101  103  107  111  112  115  119

umOrgIndex/0:
strings.properties  umOrgMsgsDiskUsage.jrb  umOrgMsgsSize.jrb

umOrgIndex/101:
strings.properties  umOrgMsgsDiskUsage.jrb  umOrgMsgsSize.jrb

umOrgIndex/103:
strings.properties  umOrgMsgsDiskUsage.jrb  umOrgMsgsSize.jrb

umOrgIndex/107:
strings.properties  umOrgMsgsDiskUsage.jrb  umOrgMsgsSize.jrb

umOrgIndex/111:
strings.properties  umOrgMsgsDiskUsage.jrb  umOrgMsgsSize.jrb

umOrgIndex/112:
strings.properties  umOrgMsgsDiskUsage.jrb  umOrgMsgsSize.jrb

umOrgIndex/115:
strings.properties  umOrgMsgsDiskUsage.jrb  umOrgMsgsSize.jrb

umOrgIndex/119:
strings.properties  umOrgMsgsDiskUsage.jrb  umOrgMsgsSize.jrb

Next I was trying to use them in reports ( jrxml ). Reports will be having rows/columns like below

Org Id     /         Org Name                 /           Org Disk Usage                          / Org Message Size

0                       test.com                                   45 %                                                   300

101                   test2.com                                  75 %                                                   450

103                   test3.com                                  20 %                                                   100

For jrb files, I will use query string as "jrobin".

string.properties have org name like test.com, test2.com etcetera.

Please tell me how it can be done.

Thanks in advance.

Regards,

Rawat

himanshu.rawat's picture
Joined: May 8 2013 - 3:23am
Last seen: 5 years 11 months ago

1 Answer:

0

let me say, there is no perfect solution for this. but once, I built soemthing similar: just implement a subreport which will be called recursivly. Then pass the datasource (tree structure of your directories), respectivly subtrees to the subreport.

It´s not so easy, but it can be done.

Cheers, Thomas

http://www.thomaszimmer.net

Thomas Zimmer's picture
Joined: Oct 2 2012 - 1:35am
Last seen: 6 days 21 min ago

Hi Thomas,

Thank you for the reply.

I will try that.

Cheers,
Rawat

himanshu.rawat - 6 years 5 months ago
Feedback