SFtpFile C Library Reference

SFtpFile

Represents a remote SFTP file.

Create/Dispose

HCkSFtpFile CkSFtpFile_Create(void);

Creates an instance of the CkSFtpFile object and returns a handle (i.e. a "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.

C "Properties"

void CkSFtpFile_getCreateTime(HCkSFtpFile handle, SYSTEMTIME *retval);

The file creation date and time. This property is only supported by servers running SFTP v4 or later.

void CkSFtpFile_getFileType(HCkSFtpFile handle, HCkString retval);

One of the following values:

  regular
  directory
  symLink
  special
  unknown
  socket
  charDevice
  blockDevice
  fifo

void CkSFtpFile_getFilename(HCkSFtpFile handle, HCkString retval);

The filename (or directory name, symbolic link name, etc.)

int CkSFtpFile_getGid(HCkSFtpFile handle);

To be documented soon...

void CkSFtpFile_getGroup(HCkSFtpFile handle, HCkString retval);

The group ownership of the file. This property is only supported by servers running SFTP v4 or later.

BOOL CkSFtpFile_getIsAppendOnly(HCkSFtpFile handle);

If true, this file may only be appended. This property is only supported by servers running SFTP v6 or later.

BOOL CkSFtpFile_getIsArchive(HCkSFtpFile handle);

If true, the file should be included in backup / archive operations. This property is only supported by servers running SFTP v6 or later.

BOOL CkSFtpFile_getIsCaseInsensitive(HCkSFtpFile handle);

This attribute applies only to directories. This attribute means that files and directory names in this directory should be compared without regard to case. This property is only supported by servers running SFTP v6 or later.

BOOL CkSFtpFile_getIsCompressed(HCkSFtpFile handle);

The file is stored on disk using file-system level transparent compression. This flag does not affect the file data on the wire. This property is only supported by servers running SFTP v6 or later.

BOOL CkSFtpFile_getIsDirectory(HCkSFtpFile handle);

If true, this is a directory.

BOOL CkSFtpFile_getIsEncrypted(HCkSFtpFile handle);

The file is stored on disk using file-system level transparent encryption. This flag does not affect the file data on the wire (for either READ or WRITE requests.) This property is only supported by servers running SFTP v6 or later.

BOOL CkSFtpFile_getIsHidden(HCkSFtpFile handle);

If true, the file SHOULD NOT be shown to user unless specifically requested.

BOOL CkSFtpFile_getIsImmutable(HCkSFtpFile handle);

The file cannot be deleted or renamed, no hard link can be created to this file, and no data can be written to the file.

This bit implies a stronger level of protection than ReadOnly, the file permission mask or ACLs. Typically even the superuser cannot write to immutable files, and only the superuser can set or remove the bit.

This property is only supported by servers running SFTP v6 or later.

BOOL CkSFtpFile_getIsReadOnly(HCkSFtpFile handle);

If true, the file is read-only. This property is only supported by servers running SFTP v6 or later.

BOOL CkSFtpFile_getIsRegular(HCkSFtpFile handle);

true if this is a normal file (not a directory or any of the other non-file types).

BOOL CkSFtpFile_getIsSparse(HCkSFtpFile handle);

The file is a sparse file; this means that file blocks that have not been explicitly written are not stored on disk. For example, if a client writes a buffer at 10 M from the beginning of the file, the blocks between the previous EOF marker and the 10 M offset would not consume physical disk space.

Some servers may store all files as sparse files, in which case this bit will be unconditionally set. Other servers may not have a mechanism for determining if the file is sparse, and so the file MAY be stored sparse even if this flag is not set.

This property is only supported by servers running SFTP v6 or later.

BOOL CkSFtpFile_getIsSymLink(HCkSFtpFile handle);

true if this is a symbolic link.

BOOL CkSFtpFile_getIsSync(HCkSFtpFile handle);

When the file is modified, the changes are written synchronously to the disk. This property is only supported by servers running SFTP v6 or later.

BOOL CkSFtpFile_getIsSystem(HCkSFtpFile handle);

true if the file is part of the operating system. This property is only supported by servers running SFTP v6 or later.

void CkSFtpFile_getLastAccessTime(HCkSFtpFile handle, SYSTEMTIME *retval);

The last-access date and time.

void CkSFtpFile_getLastErrorHtml(HCkSFtpFile handle, HCkString retval);

To be documented soon.Error information in HTML format for the last method called.

void CkSFtpFile_getLastErrorText(HCkSFtpFile handle, HCkString retval);

Error information in plain-text format for the last method called.

void CkSFtpFile_getLastErrorXml(HCkSFtpFile handle, HCkString retval);

Error information in XML format for the last method called.

void CkSFtpFile_getLastModifiedTime(HCkSFtpFile handle, SYSTEMTIME *retval);

The last-modified date and time.

void CkSFtpFile_getOwner(HCkSFtpFile handle, HCkString retval);

The owner of the file. This property is only supported by servers running SFTP v4 or later.

int CkSFtpFile_getPermissions(HCkSFtpFile handle);

The 'permissions' field contains a bit mask specifying file permissions. These permissions correspond to the st_mode field of the stat structure defined by POSIX [IEEE.1003-1.1996].

This protocol uses the following values for the symbols declared in the POSIX standard.

       S_IRUSR  0000400 (octal)
       S_IWUSR  0000200
       S_IXUSR  0000100
       S_IRGRP  0000040
       S_IWGRP  0000020
       S_IXGRP  0000010
       S_IROTH  0000004
       S_IWOTH  0000002
       S_IXOTH  0000001
       S_ISUID  0004000
       S_ISGID  0002000
       S_ISVTX  0001000

int CkSFtpFile_getSize32(HCkSFtpFile handle);

Size of the file in bytes. If the size is too large for 32-bits, a -1 is returned.

void CkSFtpFile_getSizeStr(HCkSFtpFile handle, HCkString retval);

Same as Size64, but the number is returned as a string in decimal format.

int CkSFtpFile_getUid(HCkSFtpFile handle);

To be documented soon...

BOOL CkSFtpFile_getUtf8(HCkSFtpFile handle);
void CkSFtpFile_putUtf8(HCkSFtpFile handle, BOOL newVal);

To be documented soon...

C "Methods"

BOOL CkSFtpFile_SaveLastError(HCkSFtpFile handle, const char *filename);

Saves the last error information to an XML formatted file.

const char *CkSFtpFile_fileType(HCkSFtpFile handle);

One of the following values:

  regular
  directory
  symLink
  special
  unknown
  socket
  charDevice
  blockDevice
  fifo

const char *CkSFtpFile_filename(HCkSFtpFile handle);

The filename (or directory name, symbolic link name, etc.)

const char *CkSFtpFile_group(HCkSFtpFile handle);

The group ownership of the file. This property is only supported by servers running SFTP v4 or later.

const char *CkSFtpFile_lastErrorHtml(HCkSFtpFile handle);

Error information in HTML format for the last method called.

const char *CkSFtpFile_lastErrorText(HCkSFtpFile handle);

Error information in plain-text format for the last method called.

const char *CkSFtpFile_lastErrorXml(HCkSFtpFile handle);

Error information in XML format for the last method called.

const char *CkSFtpFile_owner(HCkSFtpFile handle);

The owner of the file. This property is only supported by servers running SFTP v4 or later.

const char *CkSFtpFile_sizeStr(HCkSFtpFile handle);

Same as Size64, but the number is returned as a string in decimal format.