LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 08-30-2006, 07:09 PM   #1
kender
LQ Newbie
 
Registered: Aug 2006
Posts: 2

Rep: Reputation: 0
Date of file creation on the remote FTP host


Hello,

I’m new to shell scripting. (That was a unique and creative opening sentence, wasn’t it?) I need to write an automated FTP retriever that would download only those files from a remote host, that are older than X days. At this point I can use a ftp>dir command to get the list of all the files in the directory on the remote host (including the ones that are not older than X days) into a file on the local host. So, finally, here’s are the questions:
1. Is it possible to supply the arguments for the ftp>dir command so that it would return only the files older than X days?
2. What’s the best approach to parsing a file that contains a list of files from the remote host? I can iterate through the list with a for loop and parse every line. However, my gut feeling is that there should be a better way of doing this.

Please post any ideas that pop up, even if it's an incomplete solution!

Thanks,
Nick

Last edited by kender; 08-30-2006 at 10:57 PM.
 
Old 08-31-2006, 07:37 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
I believe it is an implementation detail regarding what, if any, time/date information is provided by a FTP server. Having said that, I would use a tool such as perl to parse something as ugly as file time/date stamps. If the server returns things in the 'ls' format, you cannot even rely on a consistant format, depending on how old the file is. And, since you are using perl anyway, why not use a perl module just made for things like retrieving files from an FTP server, like Net::FTP?

I don't see any way around parsing each file reference in the returned directory listing. I don't think there is any standard way of limiting the the scope of listed files by time/date.

--- rod.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
i want to know the command which show the date of creation of file abhi_singh4 Red Hat 6 09-16-2011 01:02 AM
File Creation Date in linux jayukanna General 5 08-21-2006 08:08 AM
ls -al file creation date blackzone Linux - Newbie 2 08-23-2004 02:31 AM
php read file creation, modified date problem antony_csf Programming 3 08-18-2004 07:46 AM
creation date of file using the 'ls' command robt Linux - Newbie 1 03-27-2003 01:34 AM


All times are GMT -5. The time now is 05:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration