LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 06: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 09:57 PM.
 
Old 08-31-2006, 06:37 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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



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 12:02 AM
File Creation Date in linux jayukanna General 5 08-21-2006 07:08 AM
ls -al file creation date blackzone Linux - Newbie 2 08-23-2004 01:31 AM
php read file creation, modified date problem antony_csf Programming 3 08-18-2004 06:46 AM
creation date of file using the 'ls' command robt Linux - Newbie 1 03-27-2003 12:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:06 PM.

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
Open Source Consulting | Domain Registration