Nathan_84 has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use File::stat; # Declare variables my $filename; my $FILE_HANDLE; my $file_stat; my $current_time; my $diff_seconds; $filename = '/path/of/file/filename.ext'; # Open the file open ($FILE_HANDLE, $filename) or die "Can't open $filename!"; # Get the file status structure $file_stat = stat($FILE_HANDLE); # Get the current time $current_time = time; # Get the elapsed time in seconds $diff_seconds = time - $file_stat->mtime; # Do whatever you want with the $diff_seconds print "\n$filename was modified $diff_seconds seconds back.\n"; # All done
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Error executing
by toolic (Bishop) on May 14, 2010 at 23:43 UTC | |
by Nathan_84 (Acolyte) on May 15, 2010 at 00:58 UTC | |
by almut (Canon) on May 15, 2010 at 09:12 UTC | |
by Nathan_84 (Acolyte) on May 15, 2010 at 22:15 UTC | |
|
Re: Error executing
by Marshall (Canon) on May 16, 2010 at 08:46 UTC | |
by Nathan_84 (Acolyte) on May 16, 2010 at 09:04 UTC |