Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WGET only the file names in an FTP directory

Tags:

wget

ftp

I am attempting to create a dynamic list of files available in an ftp directory. I assume wget can help with this but I'm not really sure how...so my question is:

What is the syntax for retrieving file names from an ftp directory using wget?

like image 445
GPSmaster Avatar asked Aug 31 '11 17:08

GPSmaster


People also ask

How do I get a list of files from an FTP server?

dir -R = Lists all files in current directory and sub directories. dir -S = Lists files in bare format in alphabetic order. Exits from FTP. Get file from the remote computer.

Can wget use FTP?

Wget is a computer tool created by the GNU Project. You can use it to retrieve content and files from various web servers. The name is a combination of World Wide Web and the word get. It supports downloads via FTP, SFTP, HTTP, and HTTPS.


1 Answers

Just execute

wget --no-remove-listing ftp://myftpserver/ftpdirectory/

This will generate two files: .listing (this is what you are looking for) and index.html which is the html version of the listing file.

like image 55
Robert Avatar answered Dec 10 '22 11:12

Robert