LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-13-2012, 01:35 PM   #1
cmosentine
LQ Newbie
 
Registered: Feb 2012
Posts: 14

Rep: Reputation: Disabled
ftp file metadata retrieval


Hi all: First time posting.

I am working on an automated ftp script to download files from many servers (desktops running ftp server). I have my generic code working. As part of the script I need to download each file AND change it's name. The new name must incorporate the creation date stamp of the file.

My script runs two separate ftp sessions (have not figured out how to do it with one session yet). The first session basically tests for the server being online and it retrieves a listing of all available files and stores the listing in a local text file. The problem is the "ls" or "dir" command don't provide a time stamp, only the date. I can get the time via "modtime" but I can't figure out how to get that into my output file. What I really need is a file that looks like this:

filename timestamp
filename timestamp
.
.
.

So, can someone show me the light? Thanks much, Chris.

Last edited by cmosentine; 02-13-2012 at 01:36 PM.
 
Old 02-13-2012, 11:40 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Do you know what distro the server is? I ask, because according to the manual http://linux.die.net/man/1/ftp the ls cmd should in fact list the equiv of 'ls -l'
Quote:
most UNIX systems will produce output from the command 'ls -l'.
However, you do have to specify the name of the remote dir, or it will ls the local dir instead; see that link
 
Old 02-14-2012, 09:44 AM   #3
cmosentine
LQ Newbie
 
Registered: Feb 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
Thanks for the reply. I should have given some more detail.

The ftp "servers" are a bunch of Windows XP workstations which generate the files I need to download. I am using the ftp service built into XP. My script will run on a SLES10 server.
 
  


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
Selective retrieval of numbers in a text file shik28 Programming 1 11-23-2011 04:40 AM
SSH config file retrieval jreige Linux - Networking 2 02-25-2008 08:38 PM
How to add metadata to png file? eyemeansit Ubuntu 3 01-15-2008 12:43 PM
metadata file does not match checksum ? anilbh Fedora 4 04-15-2007 12:08 PM
file version metadata under Unices blakemadden Programming 6 12-01-2006 09:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03: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