Can someone suggest a script to create a xml representation of all the files, alongwith the ones in the sub-directory(on Windows) by file-type. For example, if the current directory name is mypics, then for all jpg’s
<?xml version="1.0" encoding="utf-8"?>
<images xmlns="http://mydomain.com/images" version="1.0">
<image>
<big_url>myassets/pics/funnypics/big_pics/down.jpg</big_url>
</image>
<image>
<big_url>assets/pics/funnypics/big_pics/spider.jpg</big_url>
</image>
</images>
then for pdf’s
<?xml version="1.0" encoding="utf-8"?>
<pdfs xmlns="http://mydomain.com/pdf" version="1.0">
<pdf>
<big_url>myassets/pics/funnypics/big_pics/down.pdf</big_url>
</pdf>
<pdf>
<big_url>assets/pics/funnypics/big_pics/spider.pdf</big_url>
</pdf>
</pdfs>
since, number of filetype is unlimited, i can extend the suggested script
The following perl code will do the trick (maybe minus the XML file indentation):
You basically need to call
SetRequestedTypewith the type of the files group, the string describing a single file and the file extension. Then you just need to callGenerateXmlwith the XML output file name and the directory to search under.It works using ActivePerl on Windows. May need some minor adjustments in other environments.