#!/usr/bin/perl use strict; use warnings; use File::Find; my $path = shift; # what you expect to happen! # @ARGV contains one thing which is # a path to a directory. This shift removes # that path from @ARGV and it goes to $path # Now check if the "normal case" is correct or not... usage("no directory specified") if !defined $path; usage("too many arguments. Only one dir allowed") if (@ARGV !=0 ); usage("$path does not exist") if (not -e $path); usage("$path is not a directory") if (not -d $path); sub usage { my $msg = shift; print STDERR "$msg\n"; exit (1); # exit(0) is success, all other values # mean a failure as per common practice } find(\&each_file, $path); # each_file() is called for every # file underneath $path. # Note that a directory is a special # kind of a file. -f tests if this name # is a "simple file". sub each_file { # your code goes below... # $File::Find::name is the current file in this recursive # descent underneath the directory $path # if (-f $File::Find::name) #a simple file (NOT ., .., Or any other directory) { print "$File::Find::name\n"; #current file name # I would make an HTML sub to call here for that name.. } }