IPWorks SFTP 2020 .NET Edition

Questions / Feedback?

GetAttributes Event

Fires when a client needs to get file information.

Syntax

public event OnGetAttributesHandler OnGetAttributes;

public delegate void OnGetAttributesHandler(object sender, SftpserverGetAttributesEventArgs e);

public class SftpserverGetAttributesEventArgs : EventArgs {
  public string ConnectionId { get; }
  public string User { get; }
  public string Path { get; }
  public int Flags { get; }
  public int FileType { get; set; }
  public long FileSize { get; set; }
  public string FileOwner { get; set; }
  public string FileGroup { get; set; }
  public int FilePermissions { get; set; }
  public long FileATime { get; set; }
  public long FileCreateTime { get; set; }
  public long FileMTime { get; set; }
  public int FileAttribBits { get; set; }
  public int FileAttribBitsValid { get; set; }
  public string OtherAttributes { get; set; }
  public int StatusCode { get; set; }
}
Public Event OnGetAttributes As OnGetAttributesHandler

Public Delegate Sub OnGetAttributesHandler(sender As Object, e As SftpserverGetAttributesEventArgs)

Public Class SftpserverGetAttributesEventArgs Inherits EventArgs
  Public ReadOnly Property ConnectionId As String
  Public ReadOnly Property User As String
  Public ReadOnly Property Path As String
  Public ReadOnly Property Flags As Integer
  Public Property FileType As Integer
  Public Property FileSize As Long
  Public Property FileOwner As String
  Public Property FileGroup As String
  Public Property FilePermissions As Integer
  Public Property FileATime As Long
  Public Property FileCreateTime As Long
  Public Property FileMTime As Long
  Public Property FileAttribBits As Integer
  Public Property FileAttribBitsValid As Integer
  Public Property OtherAttributes As String
  Public Property StatusCode As Integer
End Class

Remarks

The GetAttributes event fires when an SFTP client sends an SSH_FXP_STAT, SSH_FXP_LSTAT or SSH_FXP_FSTAT request. Path is the file path. Flags specifies the set of file attributes the client is interested in.

File/Directory Attributes are specified using the following values:

FileType: The type of file. Can be one of the following values:

  • SSH_FILEXFER_TYPE_REGULAR (1)
  • SSH_FILEXFER_TYPE_DIRECTORY (2)
  • SSH_FILEXFER_TYPE_SYMLINK (3)
  • SSH_FILEXFER_TYPE_SPECIAL (4)
  • SSH_FILEXFER_TYPE_UNKNOWN (5)
  • SSH_FILEXFER_TYPE_SOCKET (6)
  • SSH_FILEXFER_TYPE_CHAR_DEVICE (7)
  • SSH_FILEXFER_TYPE_BLOCK_DEVICE (8)
  • SSH_FILEXFER_TYPE_FIFO (9)

FileSize: The file size, in bytes.

FileOwner: The file owner. If the ProtocolVersion configuration option is "3" (default), this field should be a numeric Unix-like user identifier. V4-V6 of the SFTP Protocol allow an arbitrary string.

FileGroup: The file owner group. If the ProtocolVersion configuration option is "3" (default), this field should be a numeric Unix-like group identifier. V4-V6 of the SFTP Protocol allow an arbitrary string.

FilePermissions: The POSIX-style file permissions.

FileATime: The file last-access time, in milliseconds since Jan 1, 1970 in UTC.

FileCreateTime: The file creation time, in milliseconds since Jan 1, 1970 in UTC.

FileMTime: The file last-modified time, in milliseconds since Jan 1, 1970 in UTC.

FileAttrBits: The file attributes, as a combination of the following values:

  • SSH_FILEXFER_ATTR_FLAGS_READONLY (0x00000001)
  • SSH_FILEXFER_ATTR_FLAGS_SYSTEM (0x00000002)
  • SSH_FILEXFER_ATTR_FLAGS_HIDDEN (0x00000004)
  • SSH_FILEXFER_ATTR_FLAGS_CASE_INSENSITIVE (0x00000008)
  • SSH_FILEXFER_ATTR_FLAGS_ARCHIVE (0x00000010)
  • SSH_FILEXFER_ATTR_FLAGS_ENCRYPTED (0x00000020)
  • SSH_FILEXFER_ATTR_FLAGS_COMPRESSED (0x00000040)
  • SSH_FILEXFER_ATTR_FLAGS_SPARSE (0x00000080)
  • SSH_FILEXFER_ATTR_FLAGS_APPEND_ONLY (0x00000100)
  • SSH_FILEXFER_ATTR_FLAGS_IMMUTABLE (0x00000200)
  • SSH_FILEXFER_ATTR_FLAGS_SYNC (0x00000400)
  • SSH_FILEXFER_ATTR_FLAGS_TRANSLATION_ERR (0x00000800)

FileAttrBitsValid: A mask specifying which bits in FileAttrBits are supported by the server.

OtherAttributes: A semi-colon (';') delimited list of Name=Value pairs of other attributes supported by SFTP. These include:

  • MIMEType (String)
  • AllocationSize (64-bit int)
  • ATimeNS (int): ATime nanoseconds
  • CreateTimeNS (int): CreateTime nanoseconds
  • MTimeNS (int): MTime nanoseconds
  • TextHint (8-bit int)
  • LinkCount (int)
  • UntranslatedName (String)

FileMimeType: The MIME type of the file.

Valid status codes are:

  • SSH_FX_OK 0
  • SSH_FX_EOF 1
  • SSH_FX_NO_SUCH_FILE 2
  • SSH_FX_PERMISSION_DENIED 3
  • SSH_FX_FAILURE 4
  • SSH_FX_BAD_MESSAGE 5
  • SSH_FX_NO_CONNECTION 6
  • SSH_FX_CONNECTION_LOST 7
  • SSH_FX_OP_UNSUPPORTED 8
  • SSH_FX_INVALID_HANDLE 9
  • SSH_FX_NO_SUCH_PATH 10
  • SSH_FX_FILE_ALREADY_EXISTS 11
  • SSH_FX_WRITE_PROTECT 12
  • SSH_FX_NO_MEDIA 13
  • SSH_FX_NO_SPACE_ON_FILESYSTEM 14
  • SSH_FX_QUOTA_EXCEEDED 15
  • SSH_FX_UNKNOWN_PRINCIPAL 16
  • SSH_FX_LOCK_CONFLICT 17
  • SSH_FX_DIR_NOT_EMPTY 18
  • SSH_FX_NOT_A_DIRECTORY 19
  • SSH_FX_INVALID_FILENAME 20
  • SSH_FX_LINK_LOOP 21
  • SSH_FX_CANNOT_DELETE 22
  • SSH_FX_INVALID_PARAMETER 23
  • SSH_FX_FILE_IS_A_DIRECTORY 24
  • SSH_FX_BYTE_RANGE_LOCK_CONFLICT 25
  • SSH_FX_BYTE_RANGE_LOCK_REFUSED 26
  • SSH_FX_DELETE_PENDING 27
  • SSH_FX_FILE_CORRUPT 28
  • SSH_FX_OWNER_INVALID 29
  • SSH_FX_GROUP_INVALID 30
  • SSH_FX_NO_MATCHING_BYTE_RANGE_LOCK 31

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks SFTP 2020 .NET Edition - Version 20.0 [Build 8263]