---
product: Chilkat
product_version: 11.7.0
language: powerbuilder
language_label: PowerBuilder
class: Scp
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/powerbuilder_ScpRef.html
---
# Chilkat Scp — PowerBuilder — v11.7.0

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

## Purpose

**Transfer files, text, and binary data over SCP using an existing SSH connection.**

`Chilkat.Scp` is the Chilkat class for SCP file transfer over an already-established `Chilkat.Ssh` connection. It supports local-file upload and download, in-memory binary transfer, encoded binary transfer, text transfer with explicit character sets, `BinData` transfer, directory-tree synchronization, sync filtering, remote UNIX permission overrides, environment variables, progress scaling, abort support, and asynchronous task integration.

**Uses an SSH connection**

Attach `Scp` to an authenticated `Chilkat.Ssh` session rather than opening a separate network connection.

**Upload and download files**

Transfer local files to remote paths or download remote files to the local filesystem using SCP.

**Memory-based transfers**

Upload or download binary data, encoded data, text, or `Chilkat.BinData` without requiring temporary files.

**Directory synchronization**

Synchronize directory trees and use filtering options to include or exclude selected files.

**Remote file options**

Set remote UNIX permissions, pass environment variables, and control transfer-related behavior required by the remote server.

**Progress and async support**

Monitor progress, scale progress percentages, abort active transfers, and run supported operations as asynchronous tasks.

**Common pattern:** Connect and authenticate with `Chilkat.Ssh`, initialize `Chilkat.Scp` with that SSH connection, then upload, download, or synchronize the desired files or in-memory data. Use `Scp` for SCP-style transfers over SSH; use `Chilkat.SFtp` when the remote server expects the SFTP protocol instead.

For an extended overview, see [Scp Class Overview](https://www.chilkatsoft.com/scp_class_overview.asp).

## Object creation, unlocking and error handling

**Object Creation**

```powerbuilder
oleobject loo_Scp
integer li_rc

loo_Scp = create oleobject
li_rc = loo_Scp.ConnectToNewObject("Chilkat.Scp")
if li_rc < 0 then
    destroy loo_Scp
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// ... use loo_Scp ...

destroy loo_Scp
```

PowerBuilder uses the Chilkat ActiveX through an `oleobject`: declare the variable, `create` it, connect it to the Chilkat class with `ConnectToNewObject`, and `destroy` it when finished. A negative return code from `ConnectToNewObject` means the ActiveX is not registered, or the registered ActiveX does not match the bitness (32-bit or 64-bit) of the PowerBuilder target.

Objects returned by methods (such as an `HttpResponse` or `JsonObject`) are also `oleobject` variables and must likewise be destroyed. A method that fails to return an object returns `null`; test with `IsNull()`. In the signatures on this page, the Chilkat class name identifies which object is expected or returned; the PowerBuilder variable type is always `oleobject`.

To bind to a specific major version of Chilkat, append the major version number to the ProgID, such as `ConnectToNewObject("Chilkat.Scp.11")` for Chilkat v11.\*.\*.

Members typed `blob` exchange binary data as a Variant byte array. The PowerBuilder examples instead use the `BinData`-based alternatives (methods ending in *Bd*), which keep binary data inside Chilkat objects.

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 PowerBuilder.

How failure is reported depends on the method's return type and is stated in the note under each method below. In every case the diagnostic text is in the `LastErrorText` property of the object whose method was called.

## 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` | `string DebugLogFilePath` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastBinaryResult` | `blob LastBinaryResult (read-only)` | read-only | This property is mainly used in SQL Server stored procedures to retrieve binary data from the last method call that returned binary data. |
| `LastErrorHtml` | `string LastErrorHtml (read-only)` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `string LastErrorText (read-only)` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `string LastErrorXml (read-only)` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `long LastMethodSuccess` | read/write | Indicates the success or failure of the most recent method call: `1` means success, `0` means failure. |
| `LastStringResult` | `string LastStringResult (read-only)` | read-only | In SQL Server stored procedures, this property holds the string return value of the most recent method call that returns a string. |
| `LastStringResultLen` | `long LastStringResultLen (read-only)` | read-only | The length, in characters, of the string contained in the LastStringResult property. |
| `VerboseLogging` | `long VerboseLogging` | read/write | If set to `1`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `string Version (read-only)` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `AbortCurrent` | property, read/write | `long AbortCurrent` |
| `SendEnv` | property, read/write | `string SendEnv` |
| `SyncedFiles` | property, read/write | `string SyncedFiles` |
| `SyncMustMatch` | property, read/write | `string SyncMustMatch` |
| `SyncMustMatchDir` | property, read/write | `string SyncMustMatchDir` |
| `SyncMustNotMatch` | property, read/write | `string SyncMustNotMatch` |
| `SyncMustNotMatchDir` | property, read/write | `string SyncMustNotMatchDir` |
| `UncommonOptions` | property, read/write | `string UncommonOptions` |
| `UnixPermOverride` | property, read/write | `string UnixPermOverride` |
| `DownloadBd` | method | `long DownloadBd(string remotePath, ChilkatBinData bd)` |
| `DownloadBinary` | method | `blob DownloadBinary(string remotePath)` |
| `DownloadBinaryEncoded` | method | `string DownloadBinaryEncoded(string remotePath, string encoding)` |
| `DownloadFile` | method | `long DownloadFile(string remotePath, string localPath)` |
| `DownloadString` | method | `string DownloadString(string remotePath, string charset)` |
| `LoadTaskCaller` | method | `long LoadTaskCaller(ChilkatTask task)` |
| `SyncTreeDownload` | method | `long SyncTreeDownload(string remoteRoot, string localRoot, long mode, long bRecurse)` |
| `SyncTreeUpload` | method | `long SyncTreeUpload(string localBaseDir, string remoteBaseDir, long mode, long bRecurse)` |
| `UploadBd` | method | `long UploadBd(string remotePath, ChilkatBinData bd)` |
| `UploadBinary` | method | `long UploadBinary(string remotePath, blob binData)` |
| `UploadBinaryEncoded` | method | `long UploadBinaryEncoded(string remotePath, string encodedData, string encoding)` |
| `UploadFile` | method | `long UploadFile(string localPath, string remotePath)` |
| `UploadString` | method | `long UploadString(string remotePath, string textData, string charset)` |
| `UseSsh` | method | `long UseSsh(ChilkatSsh sshConnection)` |

## Properties

### Scp.AbortCurrent

`Chilkat 11.7.0 · powerbuilder · Scp · AbortCurrent · property · read/write · since 9.5.0.58`

```powerbuilder
long AbortCurrent
```

Set to `1` to request cancellation of the method currently executing on this object. Long-running network and file-transfer operations check this property periodically; a method that completes quickly may finish before the request is observed.

Both synchronous and asynchronous operations can be cancelled. To cancel a synchronous call, set this property from another thread on the same `Scp` object. Chilkat resets the property to `0` after the cancellation is processed. If no method is running, a previously set value is cleared when the next method begins.

**Cooperative cancellation:** This property requests an abort; it does not forcibly terminate a thread. Use the method return value, `LastMethodSuccess` where applicable, and `LastErrorText` to determine the final outcome.

### Scp.SendEnv

`Chilkat 11.7.0 · powerbuilder · Scp · SendEnv · property · read/write · since 9.5.0.79`

```powerbuilder
string SendEnv
```

Specifies environment variables to send for each SCP upload or download. Set the property to a JSON object whose member names are environment-variable names and whose values are strings.

```
{
  "LCS_PASSWORD": "myPassword",
  "SOME_ENV_VAR": "some_value"
}
```

**Server policy controls acceptance:** SCP transfers run through SSH channels. The SSH server may accept, reject, or ignore requested environment variables according to its configuration. Do not assume that setting this property guarantees that the remote SCP process receives every variable.

**Sensitive values:** Environment variables can contain secrets, but they are not a substitute for SSH authentication. Avoid exposing sensitive values in application logs or diagnostic output.

### Scp.SyncedFiles

`Chilkat 11.7.0 · powerbuilder · Scp · SyncedFiles · property · read/write · since 9.5.0.51`

```powerbuilder
string SyncedFiles
```

Contains the local paths of the files transferred by the most recent call to `SyncTreeUpload` or `SyncTreeDownload`. Paths are listed one per line.

- After an upload, each line is the full local path of a source file that was uploaded.
- After a download, each line is the full local path of a destination file that was downloaded.

**Local paths only:** This property reports local filesystem paths, not remote paths. It lists files actually transferred by the last synchronization operation, rather than every file examined during comparison.

### Scp.SyncMustMatch

`Chilkat 11.7.0 · powerbuilder · Scp · SyncMustMatch · property · read/write · since 9.5.0.51`

```powerbuilder
string SyncMustMatch
```

Specifies a semicolon-separated list of wildcard patterns for filenames that are eligible for transfer by `SyncTreeUpload` and `SyncTreeDownload`. A file is considered only when its filename matches at least one pattern.

For example, `*.xml;*.txt;*.csv` limits synchronization to XML, text, and CSV files. The default empty string imposes no include restriction.

**Pattern scope:** Patterns are matched against the final filename, not the full local or remote path. Directory traversal is controlled separately by `SyncMustMatchDir` and `SyncMustNotMatchDir`.

### Scp.SyncMustMatchDir

`Chilkat 11.7.0 · powerbuilder · Scp · SyncMustMatchDir · property · read/write · since 9.5.0.58`

```powerbuilder
string SyncMustMatchDir
```

Specifies a semicolon-separated list of wildcard patterns for directory names that may be traversed by `SyncTreeUpload` and `SyncTreeDownload`. When this property is nonempty, synchronization descends only into directories whose names match at least one pattern.

For example, `a*;b*;c*` permits traversal into directories whose names begin with `a`, `b`, or `c`. The default empty string permits traversal into all directories, subject to `SyncMustNotMatchDir`.

**Pattern scope:** Each pattern is matched against the directory name itself, not its complete path. This property affects traversal; it does not directly select individual files.

### Scp.SyncMustNotMatch

`Chilkat 11.7.0 · powerbuilder · Scp · SyncMustNotMatch · property · read/write · since 9.5.0.51`

```powerbuilder
string SyncMustNotMatch
```

Specifies a semicolon-separated list of wildcard patterns for filenames that must be skipped by `SyncTreeUpload` and `SyncTreeDownload`.

For example, `*.tmp;*.bak;*.log` excludes temporary, backup, and log files. The default empty string excludes no files.

**Pattern scope:** Patterns are matched against the final filename, not the full path. Use `SyncMustNotMatchDir` to prevent synchronization from entering selected directories and their subtrees.

### Scp.SyncMustNotMatchDir

`Chilkat 11.7.0 · powerbuilder · Scp · SyncMustNotMatchDir · property · read/write · since 9.5.0.58`

```powerbuilder
string SyncMustNotMatchDir
```

Specifies a semicolon-separated list of wildcard patterns for directory names that must not be traversed by `SyncTreeUpload` and `SyncTreeDownload`. A matching directory and everything below it are skipped.

For example, `temp*;cache*;.git` prevents traversal into temporary, cache, and Git metadata directories. The default empty string excludes no directories.

**Pattern scope:** Each pattern is matched against the directory name itself, not its complete path. This setting is especially useful during recursive synchronization because excluding a directory avoids scanning its entire subtree.

### Scp.UncommonOptions

`Chilkat 11.7.0 · powerbuilder · Scp · UncommonOptions · property · read/write · since 9.5.0.77`

```powerbuilder
string UncommonOptions
```

Provides a comma-separated list of specialized compatibility options. The default is the empty string, which is appropriate for normal SCP transfers.

| Keyword | Behavior |
| :--- | :--- |
| `FilenameOnly` | Uses only the filename, rather than the complete target path, in the remote `scp -t` command. This option exists for compatibility with systems such as certain LANCOM routers. |
| `ProtectFromVpn` | On Android, attempts to route the SCP connection outside an installed or active VPN. |

**Leave empty unless needed:** These options alter uncommon platform or server compatibility behavior. Enable a keyword only when a Chilkat example, release note, or support response identifies it as necessary for the target environment.

### Scp.UnixPermOverride

`Chilkat 11.7.0 · powerbuilder · Scp · UnixPermOverride · property · read/write · since 9.5.0.77`

```powerbuilder
string UnixPermOverride
```

Specifies an octal UNIX permission mode to apply to files uploaded by SCP, overriding the permissions derived from the local source file. For example, set this property to `0644` to grant read/write permission to the owner and read-only permission to the group and others.

The default is the empty string, which causes the uploaded file's remote permissions to be based on the local file's permissions.

**UNIX permission notation:** Supply the mode as a string containing octal digits, such as `0600`, `0644`, or `0755`. The remote SSH account must still have permission to create or replace the file, and server-side policy may restrict the final mode.

## Methods

### Scp.DownloadBd

`Chilkat 11.7.0 · powerbuilder · Scp · DownloadBd · method · since 9.5.0.77`

```powerbuilder
long DownloadBd(string remotePath, ChilkatBinData bd)
```

Downloads the file at `remotePath` and appends its exact bytes to the existing contents of the `BinData` object in `bd`.

An absolute remote path begins with `/`. A relative path is interpreted relative to the authenticated SSH user's home directory.

**Append behavior:** This method does not clear `bd` before downloading. Clear the `BinData` object first when the downloaded file should replace, rather than follow, its current contents.

Returns 1 for success, 0 for failure.

Async variant: `DownloadBdAsync` — same arguments, returns a `Task` (see Async variants below).

### Scp.DownloadBinary

`Chilkat 11.7.0 · powerbuilder · Scp · DownloadBinary · method · since 9.5.0.51`

```powerbuilder
blob DownloadBinary(string remotePath)
```

Downloads the file at `remotePath` from the SSH server and returns its exact bytes. No character decoding or text transformation is performed.

An absolute remote path begins with `/`. A relative path is interpreted relative to the authenticated SSH user's home directory.

**In-memory download:** The complete file is returned in memory. For large files, `DownloadFile` is generally preferable because it writes directly to the local filesystem.

Returns a zero-length byte array (as a Variant) on failure.

Async variant: `DownloadBinaryAsync` — same arguments, returns a `Task` (see Async variants below).

### Scp.DownloadBinaryEncoded

`Chilkat 11.7.0 · powerbuilder · Scp · DownloadBinaryEncoded · method · since 9.5.0.51`

```powerbuilder
string DownloadBinaryEncoded(string remotePath, string encoding)
```

**Full documentation for this method (same in every language):** [List of Supported Encodings (Base64, Hex, etc.)](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/binary_encodings.md)

Downloads the file at `remotePath` and returns its bytes encoded as text using the binary encoding named by `encoding`, such as `base64` or `hex`.

An absolute remote path begins with `/`. A relative path is interpreted relative to the authenticated SSH user's home directory.

**Binary encoding versus charset:** `encoding` selects a text representation of arbitrary bytes; it is not a character set and does not decode the remote file as text. Use `DownloadString` when the remote file contains text that must be decoded with a charset.

**Memory use:** The complete file and its encoded representation are held in memory. Encodings such as Base64 also increase the amount of data returned.

Returns `null` on failure

Async variant: `DownloadBinaryEncodedAsync` — same arguments, returns a `Task` (see Async variants below).

### Scp.DownloadFile

`Chilkat 11.7.0 · powerbuilder · Scp · DownloadFile · method · since 9.5.0.51`

```powerbuilder
long DownloadFile(string remotePath, string localPath)
```

Downloads the file at `remotePath` from the SSH server and writes its bytes to the local filesystem path in `localPath`.

An absolute remote path begins with `/`. A relative remote path is interpreted relative to the authenticated SSH user's home directory. The application must have permission to create or replace the local destination file.

**Streaming transfer:** This method is the preferred download method for large files because the data is written to disk rather than returned as one in-memory byte array or string.

Returns 1 for success, 0 for failure.

Async variant: `DownloadFileAsync` — same arguments, returns a `Task` (see Async variants below).

### Scp.DownloadString

`Chilkat 11.7.0 · powerbuilder · Scp · DownloadString · method · since 9.5.0.51`

```powerbuilder
string DownloadString(string remotePath, string charset)
```

Downloads the file at `remotePath`, decodes its bytes using the character encoding named by `charset`, and returns the resulting text.

An absolute remote path begins with `/`. A relative path is interpreted relative to the authenticated SSH user's home directory.

**Charset matters:** `charset` describes how the remote file’s bytes represent characters, for example `utf-8`, `windows-1252`, or `iso-8859-1`. Using the wrong charset can produce incorrect characters. Use a binary download method for files that are not text.

Returns `null` on failure

Async variant: `DownloadStringAsync` — same arguments, returns a `Task` (see Async variants below).

### Scp.LoadTaskCaller

`Chilkat 11.7.0 · powerbuilder · Scp · LoadTaskCaller · method · since 9.5.0.80`

```powerbuilder
long LoadTaskCaller(ChilkatTask task)
```

Loads the original caller object associated with the asynchronous `Task` in `task`. `task` must be a task created by a compatible asynchronous method of this class.

**Normally not application-facing:** This is a support method for Chilkat async-task infrastructure and generated language wrappers. It does not load arbitrary task results or transfer data.

Returns 1 for success, 0 for failure.

### Scp.SyncTreeDownload

`Chilkat 11.7.0 · powerbuilder · Scp · SyncTreeDownload · method · since 9.5.0.51`

```powerbuilder
long SyncTreeDownload(string remoteRoot, string localRoot, long mode, long bRecurse)
```

Synchronizes files from the remote directory tree rooted at `remoteRoot` to the local directory rooted at `localRoot`. `bRecurse` controls recursion: set it to `1` to descend into subdirectories, or `0` to process only files directly in the root directory.

An absolute remote root begins with `/`; a relative remote root is interpreted relative to the authenticated SSH user's home directory. A relative local root is interpreted relative to the application's current working directory.

| Mode | Files transferred |
| :--- | :--- |
| `0` | Download every eligible file. |
| `1` | Download files that do not already exist locally. |
| `2` | Download files that are missing locally or whose remote last-modified time is newer than the local file. |
| `3` | Download only files whose remote last-modified time is newer. A remote file that has no local counterpart is not downloaded. |
| `5` | Download files that are missing locally or whose size differs from the local file. |
| `6` | Download files that are missing locally, differ in size, or have a newer remote last-modified time. |

The filename and directory filters in `SyncMustMatch`, `SyncMustNotMatch`, `SyncMustMatchDir`, and `SyncMustNotMatchDir` are applied during traversal. After completion, `SyncedFiles` lists the full local paths of files actually downloaded.

**Timestamp-based modes:** Modes `2`, `3`, and `6` compare last-modified times. Incorrect server timestamps or clock differences between systems can affect which file is considered newer.

Returns 1 for success, 0 for failure.

Async variant: `SyncTreeDownloadAsync` — same arguments, returns a `Task` (see Async variants below).

### Scp.SyncTreeUpload

`Chilkat 11.7.0 · powerbuilder · Scp · SyncTreeUpload · method · since 9.5.0.51`

```powerbuilder
long SyncTreeUpload(string localBaseDir, string remoteBaseDir, long mode, long bRecurse)
```

Synchronizes files from the local directory tree rooted at `localBaseDir` to the remote directory rooted at `remoteBaseDir`. `bRecurse` controls recursion: set it to `1` to descend into subdirectories, or `0` to process only files directly in the local base directory.

A relative local base directory is interpreted relative to the application's current working directory. An absolute remote base directory begins with `/`; a relative remote base directory is interpreted relative to the authenticated SSH user's home directory.

| Mode | Files transferred |
| :--- | :--- |
| `0` | Upload every eligible file. |
| `1` | Upload files that do not already exist on the remote server. |
| `2` | Upload files that are missing remotely or whose local last-modified time is newer than the remote file. |
| `3` | Upload only files whose local last-modified time is newer. A local file that has no remote counterpart is not uploaded. |
| `4` | Upload files that are missing remotely or whose size differs from the remote file. |
| `5` | Upload files that are missing remotely, differ in size, or have a newer local last-modified time. |

The filename and directory filters in `SyncMustMatch`, `SyncMustNotMatch`, `SyncMustMatchDir`, and `SyncMustNotMatchDir` are applied during traversal. After completion, `SyncedFiles` lists the full local paths of files actually uploaded.

**Timestamp-based modes:** Modes `2`, `3`, and `5` compare last-modified times. Incorrect server timestamps or clock differences between systems can affect which file is considered newer.

Returns 1 for success, 0 for failure.

Async variant: `SyncTreeUploadAsync` — same arguments, returns a `Task` (see Async variants below).

### Scp.UploadBd

`Chilkat 11.7.0 · powerbuilder · Scp · UploadBd · method · since 9.5.0.77`

```powerbuilder
long UploadBd(string remotePath, ChilkatBinData bd)
```

Uploads all bytes currently contained in the `BinData` object in `bd` to the remote file at `remotePath`. The data is transferred without character decoding or other transformation.

An absolute remote path begins with `/`. A relative path is interpreted relative to the authenticated SSH user's home directory. The remote parent directory must already exist.

**Source object:** The upload reads the current contents of `bd` and does not remove or modify those bytes.

Returns 1 for success, 0 for failure.

Async variant: `UploadBdAsync` — same arguments, returns a `Task` (see Async variants below).

### Scp.UploadBinary

`Chilkat 11.7.0 · powerbuilder · Scp · UploadBinary · method · since 9.5.0.51`

```powerbuilder
long UploadBinary(string remotePath, blob binData)
```

Uploads the exact bytes in `binData` to the remote file at `remotePath`. No text encoding, newline conversion, or other data transformation is performed.

An absolute remote path begins with `/`. A relative path is interpreted relative to the authenticated SSH user's home directory. The remote parent directory must already exist and the SSH account must have permission to create or replace the file.

**Binary-safe transfer:** Use this method for arbitrary in-memory data. For a local file, `UploadFile` avoids loading the entire source into an application byte array.

Returns 1 for success, 0 for failure.

Async variant: `UploadBinaryAsync` — same arguments, returns a `Task` (see Async variants below).

### Scp.UploadBinaryEncoded

`Chilkat 11.7.0 · powerbuilder · Scp · UploadBinaryEncoded · method · since 9.5.0.51`

```powerbuilder
long UploadBinaryEncoded(string remotePath, string encodedData, string encoding)
```

**Full documentation for this method (same in every language):** [List of Supported Encodings (Base64, Hex, etc.)](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/binary_encodings.md)

Decodes the text in `encodedData` using the binary encoding named by `encoding`, then uploads the resulting bytes to the remote file at `remotePath`. Typical encoding names include `base64` and `hex`.

An absolute remote path begins with `/`. A relative path is interpreted relative to the authenticated SSH user's home directory. The remote parent directory must already exist.

**The encoded text is not uploaded literally:** For example, when `encoding` is `base64`, Chilkat Base64-decodes `encodedData` and transfers the decoded binary bytes. This method is for encoded binary representations, not character-set conversion.

Returns 1 for success, 0 for failure.

Async variant: `UploadBinaryEncodedAsync` — same arguments, returns a `Task` (see Async variants below).

### Scp.UploadFile

`Chilkat 11.7.0 · powerbuilder · Scp · UploadFile · method · since 9.5.0.51`

```powerbuilder
long UploadFile(string localPath, string remotePath)
```

Uploads the local filesystem file at `localPath` to the remote path in `remotePath`. The file is transferred as raw bytes.

An absolute remote path begins with `/`. A relative remote path is interpreted relative to the authenticated SSH user's home directory. The remote parent directory must already exist, and the SSH account must have permission to create or replace the destination file.

Remote permissions are normally derived from the local file. Set `UnixPermOverride` when a specific remote UNIX mode is required.

**SCP is not FTP:** There is no ASCII or binary transfer mode. `UploadFile` copies the file bytes without line-ending or character-set conversion.

Returns 1 for success, 0 for failure.

Async variant: `UploadFileAsync` — same arguments, returns a `Task` (see Async variants below).

### Scp.UploadString

`Chilkat 11.7.0 · powerbuilder · Scp · UploadString · method · since 9.5.0.51`

```powerbuilder
long UploadString(string remotePath, string textData, string charset)
```

Encodes the text in `textData` using the character encoding named by `charset`, then uploads the resulting bytes to the remote file at `remotePath`.

An absolute remote path begins with `/`. A relative path is interpreted relative to the authenticated SSH user's home directory. The remote parent directory must already exist.

**Text encoding:** `charset` controls how characters are converted to bytes, for example `utf-8`, `windows-1252`, or `iso-8859-1`. SCP itself has no text mode; any line-ending characters already present in `textData` are encoded and transferred as part of the text.

Returns 1 for success, 0 for failure.

Async variant: `UploadStringAsync` — same arguments, returns a `Task` (see Async variants below).

### Scp.UseSsh

`Chilkat 11.7.0 · powerbuilder · Scp · UseSsh · method · since 9.5.0.51`

```powerbuilder
long UseSsh(ChilkatSsh sshConnection)
```

Associates this `Scp` object with the connected and authenticated `Ssh` object in `sshConnection`. Subsequent SCP operations use that existing SSH session rather than opening a separate network connection.

Connection, proxy, timeout, host-key verification, algorithm, logging, and other transport-related settings belong to the `Ssh` object and therefore apply to the SCP operations performed through it. Keep the SSH object connected and available for as long as the `Scp` object is using it.

**SCP and SFTP are different protocols:** `Scp` performs SCP-style transfers over SSH and requires compatible SCP support on the remote system. Use `Chilkat.SFtp` when the server expects the SSH File Transfer Protocol subsystem or when directory listing and remote file-management features are needed.

Returns 1 for success, 0 for failure.

## Events and callbacks

This binding has no event callbacks. For progress, percent-done or cancellation use the `*Async` variant of a method and poll the returned `Task` (`PercentDone`, `Finished`, `Cancel`).

## Async variants

Each returns a `Task` instead of the result and takes the same arguments as the synchronous method; run the task, wait for `Finished`, then read the result from the task. No new Async methods are added from 11.7.0 on.

```powerbuilder
ChilkatTask DownloadBdAsync(string remotePath, ChilkatBinData bd)
ChilkatTask DownloadBinaryAsync(string remotePath)
ChilkatTask DownloadBinaryEncodedAsync(string remotePath, string encoding)
ChilkatTask DownloadFileAsync(string remotePath, string localPath)
ChilkatTask DownloadStringAsync(string remotePath, string charset)
ChilkatTask SyncTreeDownloadAsync(string remoteRoot, string localRoot, long mode, long bRecurse)
ChilkatTask SyncTreeUploadAsync(string localBaseDir, string remoteBaseDir, long mode, long bRecurse)
ChilkatTask UploadBdAsync(string remotePath, ChilkatBinData bd)
ChilkatTask UploadBinaryAsync(string remotePath, blob binData)
ChilkatTask UploadBinaryEncodedAsync(string remotePath, string encodedData, string encoding)
ChilkatTask UploadFileAsync(string localPath, string remotePath)
ChilkatTask UploadStringAsync(string remotePath, string textData, string charset)
```

## Related classes

[`BinData`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/powerbuilder/classes/BinData.md), [`Ssh`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/powerbuilder/classes/Ssh.md), [`Task`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/powerbuilder/classes/Task.md)

