Python ftplib can't get size of file before download?

前端 未结 3 1169
遇见更好的自我
遇见更好的自我 2021-01-11 17:19

I\'m using ftplib to transfer files. Everything is working great. Now I\'m trying to get the size of the target file before downloading.

  1. First, I tried ju

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-11 17:58

    "Server complained that I can't do that in ascii mode." -- Try showing the exact code that you used AND the exact text of the server response. Use copy/paste, don't type from memory.

    Do you have access to a command-line FTP client? If not, get one. Use it to experiment with what the server can do. A client command like REMOTEHELP is your friend. Example:

    ftp> remotehelp size
    214 Syntax: SIZE  pathname
    

    This indicates that the server to which I was connected will support a SIZE command.

提交回复
热议问题