Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recursivly scan a folder, and files?

Status
Not open for further replies.

youradds

Programmer
Jun 27, 2001
817
0
0
GB
Does anyone have any code that will work on both UNIX and NT, and scan both folders and files?

Any help is much appreciated :)

Cheers

Andy
 
Andy,

The thread thread219-447155 (which was at the top of the thread-list when you posted) talks about this and gives two solutions. Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
Short answer:

@DIRLIST = qw(.) unless @DIRLIST; #I always have my scripts in the 'root' directory to be scanned, which works with this line.
use File::Find;
sub process_file {
print "$File::Find::name\n"; # or whatever;
}
find(\&process_file, @DIRLIST);

Good Luck,

-Gabe

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top