---
product: Chilkat
product_version: 11.7.0
language: c
language_label: C
class: SFtpFile
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/c_CkSFtpFileRef.html
---
# Chilkat SFtpFile — C — v11.7.0

> Chilkat 11.7.0 · language=c · class=SFtpFile
> Other versions: replace `11.7.0` in this URL. Other languages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/<lang>/classes/SFtpFile.md`.
> Language-wide rules (install, unlock, error model, strings/bytes): `https://www.chilkatsoft.com/ai-docs/v/11.7.0/c/guide.md`.

## Purpose

**Inspect metadata for a file, directory, symlink, or special item in an SFTP listing.**

`Chilkat.SFtpFile` represents one entry returned from an SFTP directory listing. It exposes the entry name, file type, size, ownership, permissions, timestamps, and server-provided attribute flags such as hidden, read-only, archive, immutable, encrypted, compressed, sparse, append-only, system, and synchronization status. It is typically used together with `Chilkat.SFtpDir` when iterating a remote directory and deciding how each entry should be displayed, filtered, downloaded, skipped, or processed.

**Name and type**

Read `Filename` and `FileType`, or use convenience flags such as `IsRegular`, `IsDirectory`, and `IsSymLink`.

**File sizes**

Access the entry size as a 32-bit integer, 64-bit integer, or decimal string using `Size32`, `Size64`, or `SizeStr`.

**Timestamps**

Inspect creation, last-access, and last-modified times as date/time values or RFC822-formatted strings when supported by the server.

**Ownership**

Read numeric user and group IDs, and when the server supports it, textual owner and group names.

**Permissions**

Inspect the POSIX-style permissions bit mask for read, write, execute, set-user-ID, set-group-ID, and sticky-bit information.

**Extended attributes**

Check server-provided flags such as hidden, read-only, archive, immutable, encrypted, compressed, sparse, append-only, system, and sync.

**Common pattern:** Retrieve a directory listing with `Chilkat.SFtp`, iterate its `Chilkat.SFtpDir` entries, and populate a `Chilkat.SFtpFile` object for each item. Use the file type, timestamps, size, permissions, and attribute flags to decide whether the entry is a regular file, directory, symlink, or special item and how the application should handle it.

**Server-version note:** Some metadata is only available from newer SFTP protocol versions. For example, textual owner/group information and creation time require SFTP v4 or later, while many extended attribute flags such as read-only, archive, immutable, compressed, encrypted, sparse, append-only, and system require SFTP v6 or later.

## Object creation, unlocking and error handling

**Create/Dispose**

```c
HCkSFtpFile instance = CkSFtpFile_Create();
// ...
CkSFtpFile_Dispose(instance);
```

`HCkSFtpFile CkSFtpFile_Create(void);`

Creates an instance of the HCkSFtpFile object and returns a handle ("void \*" pointer). The handle is passed in the 1st argument for the functions listed on this page.

`void CkSFtpFile_Dispose(HCkSFtpFile handle);`

Objects created by calling CkSFtpFile_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkSFtpFile_Dispose.

Call `Global.UnlockBundle` once at the start of the program, before using this or any other Chilkat class. Any string unlocks a fully functional 30-day trial; a purchased unlock code is used in production. See `guide.md` for the exact code in C.

## Members common to every Chilkat class

Documented once per language in `common-members.md`; listed here so this page is self-contained.

| Property | Signature | Access | Meaning |
|---|---|---|---|
| `DebugLogFilePath` | `void CkSFtpFile_getDebugLogFilePath(HCkSFtpFile cHandle, HCkString retval); void CkSFtpFile_putDebugLogFilePath(HCkSFtpFile cHandle, const char *newVal); const char *CkSFtpFile_debugLogFilePath(HCkSFtpFile cHandle);` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastErrorHtml` | `void CkSFtpFile_getLastErrorHtml(HCkSFtpFile cHandle, HCkString retval); const char *CkSFtpFile_lastErrorHtml(HCkSFtpFile cHandle);` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `void CkSFtpFile_getLastErrorText(HCkSFtpFile cHandle, HCkString retval); const char *CkSFtpFile_lastErrorText(HCkSFtpFile cHandle);` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `void CkSFtpFile_getLastErrorXml(HCkSFtpFile cHandle, HCkString retval); const char *CkSFtpFile_lastErrorXml(HCkSFtpFile cHandle);` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `BOOL CkSFtpFile_getLastMethodSuccess(HCkSFtpFile cHandle); void CkSFtpFile_putLastMethodSuccess(HCkSFtpFile cHandle, BOOL newVal);` | read/write | Indicates the success or failure of the most recent method call: `TRUE` means success, `FALSE` means failure. |
| `Utf8` | `BOOL CkSFtpFile_getUtf8(HCkSFtpFile cHandle); void CkSFtpFile_putUtf8(HCkSFtpFile cHandle, BOOL newVal);` | read/write | When set to `TRUE`, all `const char *` arguments and return values are interpreted as UTF-8 strings. |
| `VerboseLogging` | `BOOL CkSFtpFile_getVerboseLogging(HCkSFtpFile cHandle); void CkSFtpFile_putVerboseLogging(HCkSFtpFile cHandle, BOOL newVal);` | read/write | If set to `TRUE`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `void CkSFtpFile_getVersion(HCkSFtpFile cHandle, HCkString retval); const char *CkSFtpFile_version(HCkSFtpFile cHandle);` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `CreateTimeStr` | property, read-only | `void CkSFtpFile_getCreateTimeStr(HCkSFtpFile cHandle, HCkString retval); const char *CkSFtpFile_createTimeStr(HCkSFtpFile cHandle);` |
| `Filename` | property, read-only | `void CkSFtpFile_getFilename(HCkSFtpFile cHandle, HCkString retval); const char *CkSFtpFile_filename(HCkSFtpFile cHandle);` |
| `FileType` | property, read-only | `void CkSFtpFile_getFileType(HCkSFtpFile cHandle, HCkString retval); const char *CkSFtpFile_fileType(HCkSFtpFile cHandle);` |
| `Gid` | property, read-only | `int CkSFtpFile_getGid(HCkSFtpFile cHandle);` |
| `Group` | property, read-only | `void CkSFtpFile_getGroup(HCkSFtpFile cHandle, HCkString retval); const char *CkSFtpFile_group(HCkSFtpFile cHandle);` |
| `IsAppendOnly` | property, read-only | `BOOL CkSFtpFile_getIsAppendOnly(HCkSFtpFile cHandle);` |
| `IsArchive` | property, read-only | `BOOL CkSFtpFile_getIsArchive(HCkSFtpFile cHandle);` |
| `IsCaseInsensitive` | property, read-only | `BOOL CkSFtpFile_getIsCaseInsensitive(HCkSFtpFile cHandle);` |
| `IsCompressed` | property, read-only | `BOOL CkSFtpFile_getIsCompressed(HCkSFtpFile cHandle);` |
| `IsDirectory` | property, read-only | `BOOL CkSFtpFile_getIsDirectory(HCkSFtpFile cHandle);` |
| `IsEncrypted` | property, read-only | `BOOL CkSFtpFile_getIsEncrypted(HCkSFtpFile cHandle);` |
| `IsHidden` | property, read-only | `BOOL CkSFtpFile_getIsHidden(HCkSFtpFile cHandle);` |
| `IsImmutable` | property, read-only | `BOOL CkSFtpFile_getIsImmutable(HCkSFtpFile cHandle);` |
| `IsReadOnly` | property, read-only | `BOOL CkSFtpFile_getIsReadOnly(HCkSFtpFile cHandle);` |
| `IsRegular` | property, read-only | `BOOL CkSFtpFile_getIsRegular(HCkSFtpFile cHandle);` |
| `IsSparse` | property, read-only | `BOOL CkSFtpFile_getIsSparse(HCkSFtpFile cHandle);` |
| `IsSymLink` | property, read-only | `BOOL CkSFtpFile_getIsSymLink(HCkSFtpFile cHandle);` |
| `IsSync` | property, read-only | `BOOL CkSFtpFile_getIsSync(HCkSFtpFile cHandle);` |
| `IsSystem` | property, read-only | `BOOL CkSFtpFile_getIsSystem(HCkSFtpFile cHandle);` |
| `LastAccessTimeStr` | property, read-only | `void CkSFtpFile_getLastAccessTimeStr(HCkSFtpFile cHandle, HCkString retval); const char *CkSFtpFile_lastAccessTimeStr(HCkSFtpFile cHandle);` |
| `LastModifiedTimeStr` | property, read-only | `void CkSFtpFile_getLastModifiedTimeStr(HCkSFtpFile cHandle, HCkString retval); const char *CkSFtpFile_lastModifiedTimeStr(HCkSFtpFile cHandle);` |
| `Owner` | property, read-only | `void CkSFtpFile_getOwner(HCkSFtpFile cHandle, HCkString retval); const char *CkSFtpFile_owner(HCkSFtpFile cHandle);` |
| `Permissions` | property, read-only | `int CkSFtpFile_getPermissions(HCkSFtpFile cHandle);` |
| `Size32` | property, read-only | `int CkSFtpFile_getSize32(HCkSFtpFile cHandle);` |
| `Size64` | property, read-only | `__int64 CkSFtpFile_getSize64(HCkSFtpFile cHandle);` |
| `SizeStr` | property, read-only | `void CkSFtpFile_getSizeStr(HCkSFtpFile cHandle, HCkString retval); const char *CkSFtpFile_sizeStr(HCkSFtpFile cHandle);` |
| `Uid` | property, read-only | `int CkSFtpFile_getUid(HCkSFtpFile cHandle);` |

Deprecated members are listed at the end of this file with their replacements; do not use them in new code.

## Properties

### SFtpFile.CreateTimeStr

`Chilkat 11.7.0 · c · SFtpFile · CreateTimeStr · property · read-only`

```c
void CkSFtpFile_getCreateTimeStr(HCkSFtpFile cHandle, HCkString retval);
const char *CkSFtpFile_createTimeStr(HCkSFtpFile cHandle);
```

Returns the file creation date and time as an RFC 822-formatted string, such as `Fri, 21 Nov 1997 09:55:06 -0600`.

**Server requirement:** Creation-time metadata is available only when the server supports SFTP version 4 or later and provides this attribute.

### SFtpFile.Filename

`Chilkat 11.7.0 · c · SFtpFile · Filename · property · read-only`

```c
void CkSFtpFile_getFilename(HCkSFtpFile cHandle, HCkString retval);
const char *CkSFtpFile_filename(HCkSFtpFile cHandle);
```

Returns the name of the directory entry. Depending on the entry type, this may be a regular filename, directory name, symbolic-link name, or the name of another special filesystem object.

### SFtpFile.FileType

`Chilkat 11.7.0 · c · SFtpFile · FileType · property · read-only`

```c
void CkSFtpFile_getFileType(HCkSFtpFile cHandle, HCkString retval);
const char *CkSFtpFile_fileType(HCkSFtpFile cHandle);
```

Identifies the type of directory entry. The returned value is one of the following:

| Value | Meaning |
| :--- | :--- |
| `regular` | A regular file. |
| `directory` | A directory. |
| `symLink` | A symbolic link. |
| `special` | A special file whose more specific type is not reported. |
| `unknown` | The type is unknown or was not provided by the server. |
| `socket` | A socket. |
| `charDevice` | A character device. |
| `blockDevice` | A block device. |
| `fifo` | A FIFO (named pipe). |

The convenience properties `IsRegular`, `IsDirectory`, and `IsSymLink` may be used for the most common entry types.

### SFtpFile.Gid

`Chilkat 11.7.0 · c · SFtpFile · Gid · property · read-only`

```c
int CkSFtpFile_getGid(HCkSFtpFile cHandle);
```

Returns the numeric group ID associated with the file.

### SFtpFile.Group

`Chilkat 11.7.0 · c · SFtpFile · Group · property · read-only`

```c
void CkSFtpFile_getGroup(HCkSFtpFile cHandle, HCkString retval);
const char *CkSFtpFile_group(HCkSFtpFile cHandle);
```

Returns the textual group name associated with the file.

**Server requirement:** This attribute is available only when the server supports SFTP version 4 or later and provides owner/group names.

### SFtpFile.IsAppendOnly

`Chilkat 11.7.0 · c · SFtpFile · IsAppendOnly · property · read-only`

```c
BOOL CkSFtpFile_getIsAppendOnly(HCkSFtpFile cHandle);
```

Returns `TRUE` if the server marks the file as append-only. New data may be added only at the end of the file; existing data cannot be overwritten through normal file writes.

**Server requirement:** This attribute is defined for SFTP version 6 or later.

### SFtpFile.IsArchive

`Chilkat 11.7.0 · c · SFtpFile · IsArchive · property · read-only`

```c
BOOL CkSFtpFile_getIsArchive(HCkSFtpFile cHandle);
```

Returns `TRUE` if the server marks the file for inclusion in backup or archive operations.

**Server requirement:** This attribute is defined for SFTP version 6 or later.

### SFtpFile.IsCaseInsensitive

`Chilkat 11.7.0 · c · SFtpFile · IsCaseInsensitive · property · read-only`

```c
BOOL CkSFtpFile_getIsCaseInsensitive(HCkSFtpFile cHandle);
```

Applies to directories. Returns `TRUE` when names within the directory should be compared without regard to letter case.

**Server requirement:** This attribute is defined for SFTP version 6 or later.

### SFtpFile.IsCompressed

`Chilkat 11.7.0 · c · SFtpFile · IsCompressed · property · read-only`

```c
BOOL CkSFtpFile_getIsCompressed(HCkSFtpFile cHandle);
```

Returns `TRUE` if the file is stored using transparent filesystem-level compression on the server.

This attribute describes how the server stores the file. It does not change the file bytes transferred through SFTP.

**Server requirement:** This attribute is defined for SFTP version 6 or later.

### SFtpFile.IsDirectory

`Chilkat 11.7.0 · c · SFtpFile · IsDirectory · property · read-only`

```c
BOOL CkSFtpFile_getIsDirectory(HCkSFtpFile cHandle);
```

Returns `TRUE` if the directory entry is a directory.

### SFtpFile.IsEncrypted

`Chilkat 11.7.0 · c · SFtpFile · IsEncrypted · property · read-only`

```c
BOOL CkSFtpFile_getIsEncrypted(HCkSFtpFile cHandle);
```

Returns `TRUE` if the file is stored using transparent filesystem-level encryption on the server.

This attribute describes storage at rest. It does not alter the file bytes returned by read operations or accepted by write operations.

**Server requirement:** This attribute is defined for SFTP version 6 or later.

### SFtpFile.IsHidden

`Chilkat 11.7.0 · c · SFtpFile · IsHidden · property · read-only`

```c
BOOL CkSFtpFile_getIsHidden(HCkSFtpFile cHandle);
```

Returns `TRUE` if the server marks the entry as hidden. Hidden entries are normally omitted from user-facing displays unless the user specifically requests them.

### SFtpFile.IsImmutable

`Chilkat 11.7.0 · c · SFtpFile · IsImmutable · property · read-only`

```c
BOOL CkSFtpFile_getIsImmutable(HCkSFtpFile cHandle);
```

Returns `TRUE` if the server marks the file as immutable. An immutable file cannot normally be deleted, renamed, modified, or used as the target of a new hard link.

Immutability is generally stronger than read-only status, the ordinary permission mask, or an access-control list. On many systems, only a privileged administrator can set or clear this attribute.

**Server requirement:** This attribute is defined for SFTP version 6 or later.

### SFtpFile.IsReadOnly

`Chilkat 11.7.0 · c · SFtpFile · IsReadOnly · property · read-only`

```c
BOOL CkSFtpFile_getIsReadOnly(HCkSFtpFile cHandle);
```

Returns `TRUE` if the server marks the file as read-only.

**Server requirement:** This attribute is defined for SFTP version 6 or later.

### SFtpFile.IsRegular

`Chilkat 11.7.0 · c · SFtpFile · IsRegular · property · read-only`

```c
BOOL CkSFtpFile_getIsRegular(HCkSFtpFile cHandle);
```

Returns `TRUE` if the directory entry is a regular file rather than a directory, symbolic link, device, socket, FIFO, or other special type.

### SFtpFile.IsSparse

`Chilkat 11.7.0 · c · SFtpFile · IsSparse · property · read-only`

```c
BOOL CkSFtpFile_getIsSparse(HCkSFtpFile cHandle);
```

Returns `TRUE` if the server identifies the file as sparse. A sparse file can contain unwritten regions, often called holes, that read as zero bytes without consuming equivalent physical disk space.

For example, writing data at an offset of 10 MB may leave the region between the previous end of file and that offset unallocated on disk.

Some servers store all files sparsely and may always set this flag. Other servers cannot reliably determine whether a file is sparse, so a file may be sparse even when this property is `FALSE`.

**Server requirement:** This attribute is defined for SFTP version 6 or later.

### SFtpFile.IsSymLink

`Chilkat 11.7.0 · c · SFtpFile · IsSymLink · property · read-only`

```c
BOOL CkSFtpFile_getIsSymLink(HCkSFtpFile cHandle);
```

Returns `TRUE` if the directory entry is a symbolic link.

### SFtpFile.IsSync

`Chilkat 11.7.0 · c · SFtpFile · IsSync · property · read-only`

```c
BOOL CkSFtpFile_getIsSync(HCkSFtpFile cHandle);
```

Returns `TRUE` if modifications to the file are committed synchronously to server storage.

**Server requirement:** This attribute is defined for SFTP version 6 or later.

### SFtpFile.IsSystem

`Chilkat 11.7.0 · c · SFtpFile · IsSystem · property · read-only`

```c
BOOL CkSFtpFile_getIsSystem(HCkSFtpFile cHandle);
```

Returns `TRUE` if the server marks the file as part of the operating system.

**Server requirement:** This attribute is defined for SFTP version 6 or later.

### SFtpFile.LastAccessTimeStr

`Chilkat 11.7.0 · c · SFtpFile · LastAccessTimeStr · property · read-only`

```c
void CkSFtpFile_getLastAccessTimeStr(HCkSFtpFile cHandle, HCkString retval);
const char *CkSFtpFile_lastAccessTimeStr(HCkSFtpFile cHandle);
```

Returns the file's last-access date and time as an RFC 822-formatted string, such as `Fri, 21 Nov 1997 09:55:06 -0600`.

### SFtpFile.LastModifiedTimeStr

`Chilkat 11.7.0 · c · SFtpFile · LastModifiedTimeStr · property · read-only`

```c
void CkSFtpFile_getLastModifiedTimeStr(HCkSFtpFile cHandle, HCkString retval);
const char *CkSFtpFile_lastModifiedTimeStr(HCkSFtpFile cHandle);
```

Returns the file's last-modified date and time as an RFC 822-formatted string, such as `Fri, 21 Nov 1997 09:55:06 -0600`.

Use `LastModifiedTime` when a native date/time value is more convenient.

### SFtpFile.Owner

`Chilkat 11.7.0 · c · SFtpFile · Owner · property · read-only`

```c
void CkSFtpFile_getOwner(HCkSFtpFile cHandle, HCkString retval);
const char *CkSFtpFile_owner(HCkSFtpFile cHandle);
```

Returns the textual owner name associated with the file.

**Server requirement:** This attribute is available only when the server supports SFTP version 4 or later and provides owner/group names.

### SFtpFile.Permissions

`Chilkat 11.7.0 · c · SFtpFile · Permissions · property · read-only`

```c
int CkSFtpFile_getPermissions(HCkSFtpFile cHandle);
```

Returns the POSIX-style file-permission bit mask. The values correspond to the permission and special-mode bits in the POSIX `st_mode` field.

| Symbol | Octal value | Meaning |
| :--- | :--- | :--- |
| `S_IRUSR` | `0400` | Owner read |
| `S_IWUSR` | `0200` | Owner write |
| `S_IXUSR` | `0100` | Owner execute |
| `S_IRGRP` | `0040` | Group read |
| `S_IWGRP` | `0020` | Group write |
| `S_IXGRP` | `0010` | Group execute |
| `S_IROTH` | `0004` | Others read |
| `S_IWOTH` | `0002` | Others write |
| `S_IXOTH` | `0001` | Others execute |
| `S_ISUID` | `4000` | Set-user-ID |
| `S_ISGID` | `2000` | Set-group-ID |
| `S_ISVTX` | `1000` | Sticky bit |

Use bitwise AND operations to test individual permission bits.

### SFtpFile.Size32

`Chilkat 11.7.0 · c · SFtpFile · Size32 · property · read-only`

```c
int CkSFtpFile_getSize32(HCkSFtpFile cHandle);
```

Returns the file size in bytes as a 32-bit integer. Returns `-1` when the size cannot be represented by a 32-bit integer. Use `Size64` or `SizeStr` for larger values.

### SFtpFile.Size64

`Chilkat 11.7.0 · c · SFtpFile · Size64 · property · read-only`

```c
__int64 CkSFtpFile_getSize64(HCkSFtpFile cHandle);
```

Returns the file size in bytes as a 64-bit integer.

### SFtpFile.SizeStr

`Chilkat 11.7.0 · c · SFtpFile · SizeStr · property · read-only`

```c
void CkSFtpFile_getSizeStr(HCkSFtpFile cHandle, HCkString retval);
const char *CkSFtpFile_sizeStr(HCkSFtpFile cHandle);
```

Returns the file size in bytes as a base-10 string. This is the string representation of `Size64` and is useful in environments where a 64-bit integer is inconvenient or unavailable.

### SFtpFile.Uid

`Chilkat 11.7.0 · c · SFtpFile · Uid · property · read-only`

```c
int CkSFtpFile_getUid(HCkSFtpFile cHandle);
```

Returns the numeric user ID associated with the file.

## Deprecated members — do not use in new code

| Member | Kind | Deprecated in | Use instead |
|---|---|---|---|
| `GetCreateDt` | method | before 11.6.1 | — |
| `GetLastAccessDt` | method | before 11.6.1 | — |
| `GetLastModifiedDt` | method | before 11.6.1 | — |

