#! perl -w use strict; use File::Find; use File::Copy; my $line = 'C:\08\00004DC4.013'; opendir MYDIR, $line or die "Could not opendir $line: $!\n"; my @allfiles = grep { $_ ne '.' and $_ ne '..' } readdir MYDIR ; my @files = grep { !-d } @allfiles ; my @dirs = grep { -d } @allfiles ; my @select_files = join($/, grep( /\.rtf$/, @allfiles )); closedir(MYDIR); copy("$File::Find::name","C:\\temp\\/$_"); print "Current directory contains " . @files . " files and " . @dirs . " directories.\n" ; print join("\n", @allfiles);