blackadder has asked for the wisdom of the Perl Monks concerning the following question:
That produced this erroruse strict; use Win32; use Win32::ODBC; use File::Find; use File::stat; use File::Spec; use Time::localtime; system("cls"); my $start_time = ctime(); print "\nStart Time: $start_time\n\n"; print "Full Path,Size (Byte),Created,Modified,Accessed,File Name,Type\ +n"; find(\&wanted, @ARGV); sub wanted { return unless -f; my $sb = stat ($File::Find::name); my $ct = localtime $sb->ctime; my $mt = localtime $sb->mtime; my $at = localtime $sb->atime; my $size = $sb->size; my ($volume,$directories,$file) = File::Spec->splitpath($File::Fin +d::name); my $ext = $file; $ext =~ s/\.(.+)$//; printf "%s,%s,%02d/%02d/%02d,%02d/%02d/%02d,%02d/%02d/%02d,%s,%s\n +", $File::Find::name, $sb->size, $ct->mon()+1,$ct->mday(),$ct->year %100, $mt->mon()+1,$mt->mday(),$mt->year %100, $at->mon()+1,$at->mday(),$at->year %100, $file,$1 } my $end_time = ctime(); print "\nEnd Time: $end_time\n";
Any idea why this is? and how can I get the script to contineu to run even if it encounters error such as that?C:\Perl\test>file_stat.pl "t:/international" > c:\res\inter.csv The handle is invalid. Can't call method "mon" on an undefined value at C:\Perl\test\file_sta +t.pl lin e 34. C:\Perl\test>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Invalid File Handle???
by Corion (Patriarch) on Jul 13, 2005 at 11:12 UTC | |
by blackadder (Hermit) on Jul 13, 2005 at 11:36 UTC | |
by Corion (Patriarch) on Jul 13, 2005 at 12:25 UTC | |
by Fletch (Bishop) on Jul 13, 2005 at 12:39 UTC | |
by thundergnat (Deacon) on Jul 13, 2005 at 15:23 UTC | |
|
Re: Invalid File Handle???
by NetWallah (Canon) on Jul 13, 2005 at 16:55 UTC |