从命令行检索FTP目录树

使用wget / curl / whatever从ftp服务器recursion检索整个目录列表的最快方法是什么? 我不需要下载任何文件,只需要目录和文件名。 基本上什么ls -R做。

我可以用wget做的最好的是

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

这将创build包含.listing文件的空目录,其中包含ftp服务器上匹配目录的列表,并永久占用。

您可能需要使用一个真正的ftp客户端,如lftp:

 lftp -e "find;quit" ftp://ftp.example.com/ > listing.txt 
 wget -r ftp://your.site.com/