HI all,

Is there a linux command which will output the structure of a given directory as XML? if there is, that would be awesome.

Thanks very much

link|improve this question
That sounds like it wouldnt be too tough to implement upstream, you should consider adding an extension to the tree command or ask the maintainer to do it for you: mama.indstate.edu/users/ice/tree might not be a solution for right now but it may help someone else down the line. If you don't write it I will, cus its a good idea! – Andrew Bolster May 12 '10 at 11:33
Hi Andrew, Yes, this exactly what i've been thinking. I looked at the 'tree' command before I posted the question. I was surprised there was not an option on the command like tree /tmp --xml or something similar. Alas, i'm not too familiar with C (i presume it's written in that) so I would struggle to write it but by all means if you can (and of course if you have the time to do so) then that would be AWESOME. Thanks. – Jamie May 12 '10 at 16:07
feedback

3 Answers

up vote 0 down vote accepted

XMLStarlet will do this.

xml ls

link|improve this answer
feedback

As far as I know there is no standard linux command to do the job, but google-ing I found that there is a free multi platform: xml-directory-listing

Unfortunately it is written in Java.

link|improve this answer
Hi Albert, Thanks. I will give it a go and report my findings :-) – Jamie May 12 '10 at 7:54
feedback

You could easily write a script for that, using languages such as Perl, Python or Ruby should do well.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.