FTP - Get the file date and time on the remote server | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

FTP - Get the file date and time on the remote server

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-27-2005
gthokala gthokala is offline
Registered User
 
Join Date: Jun 2005
Last Activity: 9 June 2006, 10:44 AM EDT
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Question FTP - Get the file date and time on the remote server

I would like to know if there is a way to get the date and timestamp of the file that is being FTP from the remote server using shell script. Currently the get command from FTP will have current date and timestamp. Tried the earlier suggestion 'HardFeed' but still getting the current date and time and not the date and timestamp on remote server. Appreciate any help. Thanks
Sponsored Links
    #2  
Old 06-27-2005
jerardfjay jerardfjay is offline
Registered User
 
Join Date: Feb 2005
Last Activity: 9 June 2010, 12:46 PM EDT
Posts: 146
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by gthokala
I would like to know if there is a way to get the date and timestamp of the file that is being FTP from the remote server using shell script. Currently the get command from FTP will have current date and timestamp. Tried the earlier suggestion 'HardFeed' but still getting the current date and time and not the date and timestamp on remote server. Appreciate any help. Thanks
Is the remote system doing a push or are you doing a pull of the files. If the remote system is doind a push of the files onto your system, then you may want to include the date and time of the file built into the name of the file and when it comes over to your local machine there will be a visual indication of the date and time when the file was last created/modified in the remote system.
It may be possible to do the same if you are doing a pull from the remote system too.
Sponsored Links
    #3  
Old 06-27-2005
gthokala gthokala is offline
Registered User
 
Join Date: Jun 2005
Last Activity: 9 June 2006, 10:44 AM EDT
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
FTP - Get the file date and time on the remote server

Basically when trying to get a file from remote server, it will be a 'get' (pull). But I need to get the file with the date and timestamp which is on the remote server. So it is a pull from the remote server, but gets the file with current date and timestamp on it and not the date and timestamp on the remote server. I need to know how this can be achieved using shell script. Thanks
    #4  
Old 06-27-2005
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Advisor  
Forum Advisor
 
Join Date: Feb 2005
Last Activity: 19 December 2014, 1:03 AM EST
Location: Foxborough, MA
Posts: 7,679
Thanks: 156
Thanked 591 Times in 555 Posts
comp.unix.shell
Sponsored Links
    #5  
Old 06-27-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 18 December 2014, 2:02 PM EST
Location: Ashburn, Virginia
Posts: 9,930
Thanks: 64
Thanked 440 Times in 261 Posts
A complete solution is not possible and an incomplete solution would break the "freshen" feature in HardFeed. The date format changes for older files. The time is replaced with the year. HardFeed then has no time to parse. So it sets the time to "0000" making it seem that the file was created at midnight. If the local and remote copies are both old, the local timestamp will not be later than the remote timestamp and the file will be retrieved. This means that superfluous file retrieves can sometimes happen when both the local and remote copy have aged enough that the time is replaced by the year. After one superfluous retrieve this will never happen again. If HardFeed set the timestamp of the local file back to the past, this would cause older files to be retrieved on every run.
Sponsored Links
    #6  
Old 06-28-2005
gthokala gthokala is offline
Registered User
 
Join Date: Jun 2005
Last Activity: 9 June 2006, 10:44 AM EDT
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
vgersh99,
As suggested in comp.unix.shell, rcp is not an option, Since you need to have privilege on the remote server which is handled by other group.
Sponsored Links
    #7  
Old 06-28-2005
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Advisor  
Forum Advisor
 
Join Date: Feb 2005
Last Activity: 19 December 2014, 1:03 AM EST
Location: Foxborough, MA
Posts: 7,679
Thanks: 156
Thanked 591 Times in 555 Posts
is 'tar' an option as suggested?
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to FTP the latest file, based on date, from a remote server through a shell script? imran_affu Shell Programming and Scripting 9 03-08-2011 02:05 PM
Pulling the file date from remote server puni Shell Programming and Scripting 1 11-12-2010 06:53 AM
to get remote server date & time partha_ori UNIX for Dummies Questions & Answers 9 09-11-2009 03:35 AM
compare file modification date/time to current date/time Bill Ma Shell Programming and Scripting 5 08-27-2009 01:02 PM
Processing a log file based on date/time input and the date/time on the log file primp Shell Programming and Scripting 4 03-16-2008 12:23 PM



All times are GMT -4. The time now is 08:11 AM.