LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 09-15-2003, 11:49 AM   #1
kubicon
Member
 
Registered: Aug 2003
Location: Limbo
Posts: 54

Rep: Reputation: 15
outputting ftp contents to file


how can I output the output of an 'ls' command when using the ftp program(shell). Usually, on the local file system, I would do -> ls > file, but with ftp it asks me "do you wanna output to file" I answer , y, yes and it still doesn't output to the file.
 
Old 09-15-2003, 12:14 PM   #2
markus1982
Senior Member
 
Registered: Aug 2002
Location: Stuttgart (Germany)
Distribution: Debian/GNU Linux
Posts: 1,467

Rep: Reputation: 46
I'm assuming you are using lftp (ftp client). In this case it is pretty simply to write a scrit for exact that purpose.

Code:
Usage: lftp [OPTS] <site>
`lftp' is the first command executed by lftp after rc files
 -f <file>           execute commands from the file and exit
 -c <cmd>            execute the commands and exit
 --help              print this help and exit
 --version           print lftp version and exit
Other options are the same as in `open' command
 -e <cmd>            execute the command just after selecting
 -u <user>[,<pass>]  use the user/password for authentication
 -p <port>           use the port for connection
 <site>              host name, URL or bookmark name
So lftp -f example.ftp will read the commands in example.ftp. This file could contain something like:
Code:
open www.example.com
user anonymous me@example.com
ls -al
quit
So it would just be lftp -f example.ftp > output.log. You will need to adjust the paramter for ftp and the lftp command to match other ftp clients of course.
 
Old 09-15-2003, 03:01 PM   #3
kubicon
Member
 
Registered: Aug 2003
Location: Limbo
Posts: 54

Original Poster
Rep: Reputation: 15
ahh...
I mean using the regular ftp program..
$ ftp url/foo
username: foo
password: *******
ftp> ls > somefile.txt

the above doesn't work as it would on the shell
 
  


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
Viewing networked file contents with ftp linuxhippy Slackware 1 05-08-2005 09:11 AM
outputting data from a directory to a text file? minm Linux - Newbie 2 12-19-2004 07:46 PM
outputting firewall messages to a file instead if stdout schatoor Linux - Networking 2 06-25-2004 12:40 PM
MDK FTP tree Contents?? atifraza82 Mandriva 0 05-24-2004 04:40 PM
reading a text file and outputting to another. Hardw1re Programming 28 11-03-2003 09:51 AM


All times are GMT -5. The time now is 11:02 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration