title: pysftp- How to get the sftp server upload timestamp?
body: <p>I've been trying to get the time a file gets uploaded to my SFTP server, sometimes these files are big and get overwritten every day, I've tried ctime, atime and mtime but it still shows up the file modified time and not the time it finished uploading. </p>
  
  <p>For example, the use case is to get the time it actually was available in the server. When using pysftp to get ctime, mtime, atime, it shows 4:30 AM which is the last modified time and not 5:15 AM the time it was uploaded.</p>
  
  <p>without having to monitor the server every 5 minutes or so, is there a way we can get this attribute (last upload time)? </p>
  
  <p>I've been using this code, however mtime (4:30AM) shows the file last modified date and not the server upload date. any thoughts?</p>
  
  <pre><code>import pysftp
  import os
  
  cnopts = pysftp.CnOpts()
  cnopts.hostkeys = None
  
  host = 'somehost'
  port = 22
  user = 'someuser'
  password ='samplepass'
  
  with pysftp.Connection(
          host=host,
          port=port,
          username=user,
          password=password,
          cnopts=cnopts
  ) as sftp:
      sftp_client = sftp
      path = 'root_folder'
      file_list_attr = sftp.listdir_attr(remotepath=path)
      file_stat = sftp.stat(os.path.join(path, 'file.txt'))
  </code></pre>