Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Fedora This forum is for the discussion of the Fedora Project.


  Search this Thread
Old 10-12-2004, 12:00 AM   #1
LQ Newbie
Registered: Sep 2001
Location: CA, USA
Distribution: Mandrake 10.1
Posts: 14

Rep: Reputation: 0
Command Line FTP

Hi all,

Sorry if this is a newbie question, but I can't seem to figure it out. I want to use the command line ftp (or ncftp, etc...) to download several thosand files from my web server. Since there is a mix of binary and ascii files, I need to emulate the "Auto detect" feature that is available on many desktop clients (such as FileZilla, WS-FTP, etc...).

How can I "filter" the files as they are transfered so those ending in .php, .html, .css, etc are transferred as ascii and images/videos/java/etc are transfered in binary? Any ideas?

If this isn't built into one of the shell ftp programs, are there any shell scripts available that will provide this functionality? Or should I use some other app, like rsync/wget?

Old 10-12-2004, 12:44 AM   #2
Registered: Feb 2003
Location: San Antonio
Distribution: Suse 9.0 Professional
Posts: 843

Rep: Reputation: 30
Transfer all as binary. Ascii files are transferred fine with the binary option. Come to think of it, why perform a non binary transfer? Anyway, for 9 years, at least 5 times a day I binary transfer files from/to work, all types of files with no problem.

ftp <IP Address>
cd /location
mget *.php
mget *.css

or just
mget *.*

Old 10-12-2004, 02:45 AM   #3
Registered: Jun 2004
Location: Belgium
Posts: 49

Rep: Reputation: 15
Isn't the difference that when the systems are different (dos vs. unix), that ascii transfer will convert CR/LF to LF, whereas binary will keep the line breaks in the format they are in ?
Old 10-12-2004, 09:44 AM   #4
Registered: Feb 2003
Location: San Antonio
Distribution: Suse 9.0 Professional
Posts: 843

Rep: Reputation: 30
Reading the below, there is no reason to use non binary except that ascii will compress text, [although, I think this is probably trivial (today, not back when 300 baud was state of the art! ] AND if you are transferring from dos to dos, unix to unix, mac to mac. I didn't know that ascii transfer would convert from dos text to unix text (I always simply ran dos2unix <filename>) the odd time I do get/transfer a dos text file. Anyway, you can do a blanket binary transfer, converting dos text as above as needed, or simply, after all the binary transfer, simply enter
again, it will switch back to ascii, and you can mget *.txt, *.html, etc.


The "ASCII" option will allow you to very rapidly transfer text-only files that have been saved in ASCII format. (Compression is used to speed the transfer.) It also adjusts the line-feed characters (return, enter, linefeed, newline) that appear at the end of a line -- and which are different on Windows, MacOS, and Unix computers.


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
what is different with Ftp From browser and Ftp from command line zahra79 Linux - Networking 2 06-22-2005 03:26 AM
ftp command line acrors Fedora 3 10-02-2004 04:55 AM
Get Directories with Command Line FTP? BLazeD Linux - Newbie 2 09-09-2004 02:47 AM
Command Line FTP Client Donald1000 Linux - Software 3 09-19-2003 11:06 AM
command line ftp client keevitaja Linux - Software 2 09-12-2002 04:28 PM

All times are GMT -5. The time now is 12:31 AM.

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