LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   Command Line FTP (https://www.linuxquestions.org/questions/fedora-35/command-line-ftp-241583/)

erikcw 10-12-2004 12:00 AM

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?

Thanks!

RolledOat 10-12-2004 12:44 AM

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>
bi
prompt
cd /location
mget *.php
mget *.css

or just
mget *.*

RO

javeree 10-12-2004 02:45 AM

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 ?

RolledOat 10-12-2004 09:44 AM

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
bi
again, it will switch back to ascii, and you can mget *.txt, *.html, etc.

RO

http://web.nwe.ufl.edu/writing/help/...ary_ascii.html

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.


All times are GMT -5. The time now is 09:33 PM.