Elxis CMS Forum

Extensions => Components => Topic started by: jimmyz on May 05, 2011, 22:59:01

Title: Directory listing in XML file
Post by: jimmyz on May 05, 2011, 22:59:01
Hello to all fellow guys.
I'd really like someone to help me out with this: I'm trying to make a new component for elxis, but I'm having trouble creating the XML file. How can I make the directory listing in the XML file? It's about a ton of files and folders, so going by hand is out of question. I have so far tryed some solutions, like the tree command,  with no luck.

Thanks.
Title: Re: Directory listing in XML file
Post by: CREATIVE Options on May 06, 2011, 00:23:08
If you want a quick command to generate the xml, you can cd to the directory then run

Code: [Select]
find * -type f -exec  echo ‘<filename>’{}’</filename>’ \;

find * -type d -exec  echo ‘<folder>’{}’</folder>’ \;

Then you can copy the output from the terminal and paste between the files tags.
Title: Re: Directory listing in XML file
Post by: CREATIVE Options on May 06, 2011, 00:27:30
And for Max depth:

Code: [Select]
find * -maxdepth 0 -type f -exec echo ”{}” \;
find * -maxdepth 0 -type d -exec echo ”{}” \;
Title: Re: Directory listing in XML file
Post by: jimmyz on May 06, 2011, 22:50:43
Thank you. I think I have what I need, I'm goin' for it!  :D
Title: Re: Directory listing in XML file
Post by: Ivan Trebješanin on May 07, 2011, 01:11:17
I made this for generating template xml, but you can change it to suit your needs.

[attachment deleted by admin]
Title: Re: Directory listing in XML file
Post by: datahell on May 07, 2011, 10:07:52
An example on how easy to use and powerful is Elxis Nautilus.

In the upcoming Elxis Nautilus you have the option to put all or some of the files in one or more zip packages and write in your XML file just the zip package(s). Elxis Nautilus will unzip them keeping the internal zip structure. This way you don't have to write the file names one by one. Good? ;D

Example:
<archive>images.zip</archive>
<archive extract="sample/">includes.zip</archive>
Title: Re: Directory listing in XML file
Post by: jimmyz on May 07, 2011, 10:29:20
Thank you people for your suggestions and your precious time. Ivan, I will test your file, carefully. I was experimenting myself with something similar.
In anyways, Sirigos' solution seems to do the job decently. Be sure that after (and if ever) I finish, the file will be here for all of you to test/judje.


Keep it up,
Jim, Thassos