Last Update on FTP transfer, perl call ?

Posted on 2003-12-08
Last Modified: 2013-12-25
Perl/CGI; I use a lot of .lib files, common library, such as:

require "meter_library_data_file.lib";

Our database administrator uses above .lib file for keeping updates that is used by management and sales to keep track on what is going on.  Lots of times, a sales person or other will wonder when the last time something was updated.  Question:  Is there a way for perl to know when a certain file was overwritten, hence updated?  Files are simply transfer via FTP to a web server.  I know how to call time:

$date = `/bin/date`;

" current date and time is $date "

But that is current time, not when a file was overwritten or updated.  Unix/lynx webserver is used.

Question by:precision
  • 3
  • 2

Expert Comment

ID: 9897804
You want to use stat, which, in list context, will return a 13 element list giving the statistics for a file.

Example of use:

my @filedata = stat('/bin/date');
print "last modified on".gmtime($filedata[9]);

Author Comment

ID: 9904273
File of change upon ftp upload:  client_data.lib
File that looks for last upload date of client_data.lib is "compile.cgi"
so, is this correct ???

$filedata = "client_data.lib";

my @filedata = stat('/bin/date');
print "last modified on".gmtime($filedata[9]);

Accepted Solution

mrh30 earned 175 total points
ID: 9904289

$filedata = "client_data.lib";
my @filedata = stat("bin/$filedata"); # Or whatever the path to the file actually is
print "Modified: ".gmtime($filedata[9]);

Author Comment

ID: 9904420
Cool, getting close, works but how do I make it EST????  I see it displays but shows gmtime...thanks...great job

Expert Comment

ID: 9904447
Use localtime instead of gmtime

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Simple JavaScript form question 4 73
How can I modify this Excel worksheet with a script? 15 82
exchange ,script 10 43
How to create a textarea which saves text in HTML 8 37
Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question