#!/usr/bin/perl
# perl script to traverse a file-tree
# File beginning with a '.' are omitted

my $path = $ARGV[0];

&scan_files($path);

print "\n";
exit(0);

#--------------------------------------------------------------------------
sub scan_files 
  {
  my (@scandirs,$scandir,@files,$file,$list);
  $scandir = $_[0];
  opendir(DIR,$scandir) || warn "can't open the directory $scandir: $!\n";
  @scandirs = grep {!(/^\./) && -d "$scandir/$_"} readdir(DIR);
  rewinddir(DIR);
  @files=grep {!(/^\./) && -f "$scandir/$_"} readdir(DIR);
  closedir (DIR);
  for $list(0..$#scandirs) 
    {
    &scan_files($scandir."/".$scandirs[$list]);
    }
  if ($#files >= 0)
    {
    print "<b>$scandir</b> contains the following files:\n";
    foreach $file(@files)
      {
      print $scandir."/".$file, "\n";
      }
    }
  return 1;
  }

