Traversing FTP listing

前端 未结 5 1734
广开言路
广开言路 2020-12-18 03:39

I am trying to to get all directories\' name from an FTP server and store them in hierarchical order in a multidimensional list or dict

So for example, a server that

5条回答
  •  Happy的楠姐
    2020-12-18 04:21

    You're not going to like this, but "it depends on the server" or, more accurately, "it depends on the output format of the server".

    Different servers can be set to display different output, so your initial proposal is bound to failure in the general case.

    The "naive and slow implementation" above will cause enough errors that some FTP servers will cut you off (which is probably what happened after about 7 of them...).

提交回复
热议问题