#! /usr/bin/env perl

use Cwd qw( realpath );
use File::Spec::Functions;

my $dirToWalk = realpath($ARGV[0] || '.');

##print "Processing directory '$dirToWalk'\n";

print <<EOT;
<?xml version="1.0"?>
<fileList>
EOT
opendir(my $dH, $dirToWalk) || die("Failed to open directory\n$!");
while (my $f = readdir($dH)) {
    next if $f =~ /^\.|~$/;
    $f = catfile($dirToWalk, $f);
    print "  <file>$f</file>\n";
}
closedir($dH);
print "</fileList>\n";
