How do I recursively ftp only certain file types from a linux server using the command line?
file, ftp, recursion, types
Solution
You can do it with wget
wget -r -np -A "*.htm*" ftp://site/dir
or:
wget -m -np -A "*.htm*" ftp://user:pass@host/dir
However, as per Types of Files:
Note that these two options do not affect the downloading of HTML files (as determined by a `.htm` or `.html` filename prefix). This behavior may not be desirable for all users, and may be changed for future versions of Wget.
Problem
I want to download only .htm or .html files from my server. I'm trying to use ncftpget and even wget but only with limited success. with ncftpget I can download the whole tree structure no problem but can't seem to specify which files I want, it's either all or nothing. If I specify the file type like this, it only looks in the top folder: ``` ncftpget -R -u myuser -p mypass ftp://ftp.myserver.com/public_html/*.htm ./local_folder ``` If I do this, it downloads the whole site and not just .htm files: ``` ncftpget -R -u myuser -p mypass ftp://ftp.myserver.com/public_html/ ./local_folder *.htm ``` Can I use ncftp to do this, or is there another tool I should be using?