#!/usr/bin/perl -w print "enter the path :"; chomp($q = <STDIN>); sub recurse($); print "the file are:";recurse($q); sub recurse($){ my($path)=@_; $path.='/' if ($path!~/\/$/); #print $path,"\n"; $count=0; for my $eachFile(glob($path.'*')){ if(-d $eachFile){ recurse($eachFile); } elsif($eachFile=~m/.txt/){ @file_name=(@file_name,$eachFile); print "$eachFile\n"; } } } $count=@file_name; print "\n Number of files are $count \n"; print "\n";
In reply to Read all the file path having text document by navzit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |