Thank you and its working now. If possible can I know how to tweak my script to get filenames, date and time in addition to counts.
#!/usr/local/bin/perl my $dir= ('c:\My Projects\Perl Scripts\New Folder') ; $directory_count = 0; $file_count=0; $outfile = 'log.txt'; open my $OUTF, "> $outfile" or die print " can't create logfile; $!"; opendir( DIR, "$dir" ) ; my @files = readdir( DIR ) ; foreach $file ( @files ) { if ( -f "$dir/$file") { $directory_count++; } else { $file_count++; } } print {$OUTF) "Directories: $directory_count |"; print ($OUTF) "Files: $file_count\n"; closedir( DIR ) ; } close OUTF ;
In reply to Re^2: log file in perl.
by manu_06
in thread log file in perl.
by manu_06
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |