# perl program to traverse a file-tree
# Files beginning with a '.' are omitted

use strict;
use warnings;

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 "$file\n";
      }
    }
  return 1;
  }
