python - How to get size of remote file? -
python - How to get size of remote file? -
how size of remote file after upload file, using sftp paramiko client ? ?
ssh = paramiko.sshclient() ssh.set_missing_host_key_policy(paramiko.autoaddpolicy()) ssh.connect( cs.host, username = 'test', password = 'test', timeout=10) sftp = ssh.open_sftp() res = sftp.put(filepath, destination )
?
use .stat()
method:
info = self.sftp.stat(destination) print info.st_size
the .stat()
method follows symlinks; if not desirable, utilize .lstat()
method instead.
see sftpattributes
class information attributes available. .st_size
size in bytes.
python paramiko
Comments
Post a Comment