[英]How do i check if a file exists on remote server using python?
我有一些代碼可以將文件復制到遠程目標。 它使用UNC路徑映射目錄,然后執行復制。
文件大小很大,因此一次又一次的復制需要時間。 我需要檢查文件是否存在,並且是否有效,如未使用python損壞。 這是一個可執行文件。 我正在使用Windows平台。
試試paramiko sftpclient,
說你有聯系
sftp = ssh.open_sftp()
try:
sftp.get(remote_path, local_path)
except IOError:
#set a variable here to know whether file exists
pass
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.