#!/usr/bin/perl # # Prabu 8/22/04 # # This script file has been customized for Windows 32 # # This perl script finds the number of files present in given directory # $f = $ARGV[0]; #$f =~ s/\s*$//; #$f =~ s#'#\\'#g; # prefix meta char for any apostraphies @files = `dir/b $f`; # DIR/B lists files as well as folders one per line without summary # for loop works in DOS for ($idx = 0; $idx <= $#files; $idx++) { print " ** $files[$idx]\n"; } $totalcount = $#files + 1; print "\n Directory $f has $totalcount total entries \n\n"; $filecount = 0; # foreach works in DOS foreach $file (@files) { $file =~ s/\s*$//; if (-f $file) { # file test works in DOS print " -- $file\n"; $filecount++; } } print "\n Directory $f has $filecount files \n\n"; exit(0);