Introducing the dir-to-xml gem

require 'dir-to-xml'

dynarex = DirToXML.new('.').to_dynarex
dynarex.sort_by!{|x| x.text('last_modified')}
File.open('index.xml','w'){|f| f.write dynarex.to_xml}

The dir-to-xml gem basically stores the names of the files in a dynarex file. By default executing DirToXML.new automatically stores a file called dir.xml in the currenty directory.

In this example the files are sorted by their modification date before storing them as a dynarex file called index.xml.

Resources

Tags:
Source:
1858hrs.txt
Published:
20-01-2012 18:58