[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Last Update on FTP transfer, perl call ?

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

require "meter_library_data_file.lib";
&meter_readings;

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`;
chomp($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.

???????????/
0
Comment
Question by:precision
[X]
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
5 Comments
 
LVL 3

Expert Comment

by:mrh30
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]);
0
 

Author Comment

by:precision
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]);
0
 
LVL 3

Accepted Solution

by:
mrh30 earned 700 total points
ID: 9904289
Nope:

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

Author Comment

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

Expert Comment

by:mrh30
ID: 9904447
Use localtime instead of gmtime
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

656 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