4

What would be the fastest way to recursively retrieve entire directory listing from an ftp server using wget/curl/whatever? I don't need to download any files, just directory and file names. Basically what ls -R does.

user187291
  • 141
  • 1
  • 2

2 Answers2

6

The best I can do with wget is

wget -r --spider --no-remove-listing ftp://ftp.example.com/

Which will create empty directories containing a .listing file with the listing of the matching directory on the ftp server, and take forever.

You'll probably need to use a real ftp client like lftp:

lftp -e "find;quit" ftp://ftp.example.com/ > listing.txt
DerfK
  • 19,493
  • 2
  • 38
  • 54
0
wget -r ftp://your.site.com/
Peter K.
  • 80
  • 5
  • 17