xfl - a Python module to create and compare file lists in XML

xfl is a simple Python module to store and compare lists of files and complete directory trees in XML. It uses the ElementTree module to provide a pythonic interface to XML.

xfl manages basic file lists including file and directory names, sizes, modification times and owners. The hierarchical structure of a directory tree is simply reproduced as nested XML tags. Here is a simple example:

<dirtree name="C:\Python25\Tools" time="1187522227.44">
  <dir name="i18n">
    <file name="makelocalealias.py" size="2080" mtime="1130526398.0" owner="BUILTIN\Administrators"/>
    <file name="msgfmt.py" size="5704" mtime="1144404866.0" owner="BUILTIN\Administrators"/>
    <file name="pygettext.py" size="22773" mtime="1130526398.0" owner="BUILTIN\Administrators"/>
  <dir name="pynche">
    <file name="ChipViewer.py" size="5158" mtime="1130526398.0" owner="BUILTIN\Administrators"/>
    <dir name="X">
      <file name="rgb.txt" size="18128" mtime="1130526398.0" owner="BUILTIN\Administrators"/>
      <file name="xlicense.txt" size="1381" mtime="1130526398.0" owner="BUILTIN\Administrators"/>

Two XML file lists may be compared in order to check which files are identical, have been added, changed or deleted.


Just run xfl.py from the command line to get information on its usage as a script.

To create a new XML file list:

xfl.py <root path> <XML file>

To create a new XML file list and compare to a previous state:

xfl.py <root path> <XML file> <previous XML file>

xfl is extensible: it is easy to import it in a custom script in order to store additional information about each file or directory. As an example, the provided script xfl-crc.py stores the CRC32 hash of each file to demonstrate a simple integrity checker. It could be easily extended to add MD5, SHA1 or SHA256 fingerprints.


CeCILL v2, open-source.


Click on the icon below.


xfl_0.06.zip4.42 KB