SFTPFileAttributes Type

A set of attributes for a file existing on an SFTP server..

Remarks

This type describes a file residing on an SFTP server.

Fields

AccessTime
Long

The number of milliseconds since 12:00:00 AM January 1, 1970 when this file was last accessed.

AccessTimeNanos
Integer

A subsecond value associated with this file's AccessTime.

ACL
String

A string containing an Access Control List (ACL).

AllocationSize
Long

The size, in bytes, that this file consumes on disk.

AttributeBits
Integer

AttributeBits and AttributeBitsValid each contain a bitmask representing attributes of the file on the SFTP server. These two values must be interpreted together. Any value present in AttributeBitsValid must be ignored in AttributeBits. This is done so that the server and client can communicate the attributes they know about without confusing any bits they do not understand.

This field can have one or more of the following values OR'd together:

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

AttributeBitsValid
Integer

AttributeBits and AttributeBitsValid each contain a bitmask representing attributes of the file on the SFTP server. These two values must be interpreted together. Any value present in AttributeBitsValid must be ignored in AttributeBits. This is done so that the server and client can communicate the attributes they know about without confusing any bits they do not understand.

This field can have one or more of the following values OR'd together:

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

CreationTime
Long

The number of milliseconds since 12:00:00 AM January 1, 1970 when this file was created.

CreationTimeNanos
Integer

A subsecond value associated with this file's CreationTime.

FileType
SFTPFileTypes

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

1 (sftRegular - default)A normal file.
2 (sftDirectory)A directory.
3 (symlink)The file is a Unix symbolic link.
4 (sftSpecial)The file type is a special system file.
5 (sftUnknown)The file type is unknown.
6 (sftSocket)The file handle is a socket handle.
7 (sftCharDevice)The file handle is a character input device.
8 (sftBlockDevice)The file handle is a block input device.
9 (sftpFIFO)The file handle is a buffering input device.

Flags
Integer

Flags is an integer containing a bitmask that indicates which fields are valid. When retrieving file attributes from an SFTP server, this field indicates which values were read by the component. When setting values, the field is used to determine which values get passed to the server.

Flags may be bitwise-ORed with any of the following values:

0x00000001 (SSH_FILEXFER_ATTR_SIZE)Size is valid.
0x00000002 (SSH_FILXFER_ATTR_UIDGID)OwnerId and GroupId are valid. Note: this attribute is only valid when using SFTP protocol version 3.
0x00000004 (SSH_FILEXFER_ATTR_PERMISSIONS)Permissions is valid.
0x00000008 (SSH_FILEXFER_ATTR_ACCESSTIME)AccessTime is valid. Note: for protocol version 3, this also denotes that ModifiedTime is valid.
0x00000010 (SSH_FILEXFER_ATTR_CREATETIME)CreationTime is valid. Note: this attribute is only valid when using SFTP protocol version 4 and above.
0x00000020 (SSH_FILEXFER_ATTR_MODIFYTIME)ModifiedTime is valid. Note: this attribute is only valid when using SFTP protocol version 4 and above.
0x00000040 (SSH_FILEXFER_ATTR_ACL)ACL is valid. Note: this attribute is only valid when using SFTP protocol version 4 and above.
0x00000080 (SSH_FILEXFER_ATTR_OWNERGROUP)OwnerId and GroupId are valid. Note: this attribute is only valid when using SFTP protocol version 4 and above.
0x00000100 (SSH_FILEXFER_ATTR_SUBSECOND_TIMES)AccessTimeNanos, CreationTimeNanos and ModifiedTimeNanos are valid. Note: this attribute is only valid when using SFTP protocol version 4 and above.
0x00000200 (SSH_FILEXFER_ATTR_BITS)AttributeBits is valid. Note: this attribute is only valid when using SFTP protocol version 5 and above. When using SFTP protocol version 6 and above, this also indicates that AttributeBitsValid is valid.
0x00000400 (SSH_FILEXFER_ATTR_ALLOCATION_SIZE)AllocationSize is valid. Note: this attribute is only valid when using SFTP protocol version 6 and above.
0x00000800 (SSH_FILEXFER_ATTR_TEXT_HINT)TextHint is valid. Note: this attribute is only valid when using SFTP protocol version 6 and above.
0x00001000 (SSH_FILEXFER_ATTR_MIME_TYPE)MIMEType is valid. Note: this attribute is only valid when using SFTP protocol version 6 and above.
0x00002000 (SSH_FILEXFER_ATTR_LINK_COUNT)LinkCount is valid. Note: this attribute is only valid when using SFTP protocol version 6 and above.
0x00004000 (SSH_FILEXFER_ATTR_UNTRANSLATED_NAME)UntranslatedName is valid. Note: this attribute is only valid when using SFTP protocol version 6 and above.
0x80000000 (SSH_FILEXFER_ATTR_EXTENDED)There are extended (vendor-specific) values associated with the file. This attribute is currently ignored by the component.

GroupId
String

The id of the group that has access rights this file.

IsDir
Boolean

Whether or not the file represented by these attributes is a directory.

IsSymlink
Boolean

Whether or not the file or directory represented by these attributes is a symbolic link. This setting is only applicable when GetSymlinkAttrs is set to True. By default the attributes of the actual file referred to by the link (not the symbolic link itself) are returned and this field will always be False.

LinkCount
Integer

The number of links that reference this file.

MIMEType
String

A value that can be used in the Content-Type header for a MIME entity part containing this file.

ModifiedTime
Long

The number of milliseconds since 12:00:00 AM January 1, 1970 that this file was last modified.

ModifiedTimeNanos
Integer

A subsecond value associated with this file's ModifiedTime.

OwnerId
String

The user id of this file's owner.

Permissions
Integer

A 32-bit integer containing the a POSIX-compatible file permission bitmask.

The bitmask should be interpreted as a decimal value of a series of octal digits. For example, an octal permission value of "100644" would be "33188" in base-10, and "40755" in octal would be "16877" in base-10.

The last three octal digits are the most significant and represent, in order, the file access capabilities of the file's owner, the owner's group and other users. Each of these octal digits is, on its own, a 3-bit bitmask with the following possible values:

1 (001)Execute
2 (010)Write
4 (100)Read

An octal permission digit of 7 would have all three values set and would mean that the file can be read, written and executed by that user class. For example, the octal permissions "100644" would have a value "6" for the owner, "4" for the group, and "4" for other users. This would be interpreted to mean that all users can read the file, no users can execute it and only the owner can write it. The permissions "40755" would mean that all users can read and execute the file, but only the owner can write it.

The previous octal digit is another bitmask with the following values:

1 (001)Sticky Bit - retain the file in memory for performance
2 (010)Set GID - sets the group ID of the process to the file's group ID upon execution (only for executable files)
4 (100)Set UID - sets the user ID of the process to the file's user ID upon execution (only for executable files)

The previous two octal digits are used together as a bitmask to determine the type of file. This bitmask has the following values:

01 (000001)Named pipe
02 (000010)Character special
04 (000100)Directory
06 (000110)Block special
10 (001000)Regular
12 (001010)Symbolic link
14 (001100)Socket

For example, the octal file permissions "100644" would indicate a regular file and octal "40755" would indicate a directory.

Please note that you will need to convert the octal permissions bitmask into its decimal representation

PermissionsOctal
String

An octal string containing the a POSIX-compatible file permission bitmask

The bitmask should be interpreted as a series of octal digits. For example, "100644" and "40755".

The last three octal digits are the most significant and represent, in order, the file access capabilities of the file's owner, the owner's group and other users. Each of these octal digits is, on its own, a 3-bit bitmask with the following possible values:

1 (001)Execute
2 (010)Write
4 (100)Read

An octal permission digit of 7 would have all three values set and would mean that the file can be read, written and executed by that user class. For example, the octal permissions "100644" would have a value "6" for the owner, "4" for the group, and "4" for other users. This would be interpreted to mean that all users can read the file, no users can execute it and only the owner can write it. The permissions "40755" would mean that all users can read and execute the file, but only the owner can write it.

The previous octal digit is another bitmask with the following values:

1 (001)Sticky Bit - retain the file in memory for performance
2 (010)Set GID - sets the group ID of the process to the file's group ID upon execution (only for executable files)
4 (100)Set UID - sets the user ID of the process to the file's user ID upon execution (only for executable files)

The previous two octal digits are used together as a bitmask to determine the type of file. This bitmask has the following values:

01 (000001)Named pipe
02 (000010)Character special
04 (000100)Directory
06 (000110)Block special
10 (001000)Regular
12 (001010)Symbolic link
14 (001100)Socket

For example, the octal file permissions "100644" would indicate a regular file and octal "40755" would indicate a directory.

Size
Long

The total size, in bytes, of this file.

TextHint
Integer

Provides a hint for whether or not the file is a text file.

UntranslatedName
String

The untranslated name of the file.

Copyright (c) 2023 /n software inc. - All rights reserved.
IPWorks SSH 2020 .NET Edition - Version 20.0 [Build 8501]