Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 09-15-2003, 10:49 AM   #1
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, 11:14 AM   #2
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.

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:
user anonymous
ls -al
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, 02:01 PM   #3
Registered: Aug 2003
Location: Limbo
Posts: 54

Original Poster
Rep: Reputation: 15
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


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

All times are GMT -5. The time now is 01:39 PM.

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