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

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -