#! /usr/bin/perl use Parse; use Moving; use File::Copy my @filelist = (); # all filenames will go into this global array my $txt_folder = '/temp/'; &check_folders($txt_folder); foreach $file (@filelist) { print "file is $file\n"; Parse::parse_file($file); Moving::move_file($file); } sub check_folders { #iterate thru directory, this works my($dir) = @_; local (*FOLDER); # use local for filehandles my(@subfiles, $file, $specfile); opendir(FOLDER, $dir) or die "cannot open $dir"; @subfiles = readdir(FOLDER); closedir(FOLDER); foreach $file (@subfiles) { # ignore files beginning with a period next if ($file =~ m/^\./); #$specfile = $dir . ':' . $file; $specfile = $dir . $file; if (-d $specfile) { print "directory is $specfile\n"; &check_folders($specfile); # RECURSION } elsif (-f $specfile) { push(@filelist, $specfile); # # do your text line stuff here }#if }#for }#sub __END__