in reply to
How do you list all files under a directory?
Here is some code to find emacs ~ files and delete them.
# list of dirs to look in
my @start_dirs = (
my $finder = File::Finder
# do not go into the ~chad/Archives/ directory.
# match the following properties.
->type('f') # files
->name('*~') # named glob(*~)
->ctime('+6') # inode changed time more than 6 days ago
# ->ls() # print `ls -l` of file
# run the finder command now.
my @file_list = $finder->in(@start_dirs);
# delete the found files.
my $count = unlink @file_list;
print "\nUnlinked $count files.\n";