Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I FTP a newer file over

Status
Not open for further replies.

byuen

Programmer
May 14, 2003
6
US
Hello all,
What i am trying to do is write a script in which i ftp into an another server and download the file back onto my server. What i want to do is , if its a newer file, i want to replace the older file on my server with this newer one. And if the the same file, i just want to delete the file i just downloaded.
So the way i approached it, is i downloaded the directory from the FTP site, and i wanted to compare the dates in that file to the dates i have on my server. Can anyone help me out, on how to search for a string like 'May 14 11:23' and then compare it to another date like 'May 10 10:55'? And if the date is newer, how can i approach replacing the file on my server, with the newer file?
Much help is appreciated.
 
See if your version of ftp has the 'newer' command.

newer file-name
Get the file only if the modification time of the remote file is
more recent that the file on the current system. If the file
does not exist on the current system, the remote file is
considered newer. Otherwise, this command is identical to get.

 
my ftp doesnt have the 'newer' command..any other suggestions?
 
Rather than duplicate it here: Go to the FAQ, (top of this page is the tab for it) Several options there, do what it sounds like you are looking for.

-Mike.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top