Last Update on FTP transfer, perl call ?

Posted on 2003-12-08
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 700 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

801 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