StpItem.Created property - wrong data?

0 votes
asked Aug 23, 2012 by Giovanni (210 points)
edited Aug 27, 2012

Hello, When I retrieve and display the list of files and directories, I use this code

  SftpItemCollection list = client.GetList();
  foreach (SftpItem item in list)
  {
      if (item.IsFile)
      {
          ...

but when I try to access to item.Created property the result is always, for all files, "01/01/1970 00:00:00". Why?

Applies to: Rebex SFTP

3 Answers

+1 vote
answered Aug 23, 2012 by Lukas Pokorny (120,490 points)
edited Aug 23, 2012

Creation time is only reported by SFTP servers which use SFTP v4 and later. However, the majority of SSH/SFTP servers in use only support SFTP v3 (the most notable example is OpenSSH, whose developers don't have any plans to support it).

To check whether your server supports SFTP v4, use Sftp object's ProtocolVersion property.

Please note that SftpItem.Created property is obsolete and has been replaced with SftpItem.CreationTime property, which (unlike SftpItem.Created) returns nullable DateTime, making it possible to easily detect 'not available' results (unlike SftpItem.Created, which uses zero Unix time - "01/01/1970 00:00:00" - to indicate the same).

0 votes
answered Aug 23, 2012 by Giovanni (210 points)
edited Aug 23, 2012

Thanks for response.

0 votes
answered Aug 27, 2012 by Giovanni (210 points)
edited Aug 27, 2012

I used build 4060 and in this version not exist CreationTime property. Now I download 2012R2 Version and I have a that property, but is null. I used ssh sftp server on WinXP (virtualbox machine)

commented Aug 27, 2012 by Tomas Knopp (58,890 points)
edited Aug 27, 2012

The SFTP server you are using does not support SFTP protocol version 4. CreationTime property is only supported by servers which support SFTP version 4. If they only support version 3, the CreationTime property will be null. I suggest that you try to install a SFTP server which supports version 4 ( e.g. http://dl.bitvise.com/BvSshServer-Inst.exe ).

...