

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 傳輸檔案
<a name="transfer-files-and-track"></a>

**Topics**
+ [使用 SFTP 連接器傳送和擷取檔案](#send-retrieve-connector-details)

## 使用 SFTP 連接器傳送和擷取檔案
<a name="send-retrieve-connector-details"></a>

若要使用 SFTP 連接器傳送和擷取檔案，您可以使用 [https://docs.aws.amazon.com/transfer/latest/APIReference/API_StartFileTransfer.html](https://docs.aws.amazon.com/transfer/latest/APIReference/API_StartFileTransfer.html) API 操作並指定下列參數，具體取決於您是*傳送檔案* （傳出傳輸） 還是*接收檔案* （傳入傳輸）。請注意，每個`StartFileTransfer`請求可以包含 10 個不同的路徑。

**注意**  
 根據預設，SFTP 連接器一次處理一個檔案，依序傳輸檔案。您可以選擇使用支援相同使用者並行工作階段的遠端伺服器建立並行工作階段，並平行處理最多 5 個檔案，以加速傳輸效能。  
 若要啟用任何連接器的並行連線，您可以在建立或更新連接器時編輯**並行連線上限**設定。如需詳細資訊，請參閱[使用服務管理的輸出建立 SFTP 連接器](create-sftp-connector-procedure.md)。
+ **傳出傳輸** 
  + `send-file-paths` 包含從 1 到 10 個來源檔案路徑，讓檔案傳輸到合作夥伴的 SFTP 伺服器。
  + `remote-directory-path` 是將檔案傳送到客戶 SFTP 伺服器上的遠端路徑。
+ **傳入傳輸** 
  + `retrieve-file-paths` 包含 1 到 10 個遠端路徑。每個路徑都會指定將檔案從合作夥伴的 SFTP 伺服器傳輸至 Transfer Family 伺服器的位置。
  + `local-directory-path` 是存放檔案的 Amazon S3 位置 （儲存貯體和選用字首）。

若要傳送檔案，請指定 `send-file-paths`和 `remote-directory-path` 參數。您最多可以為 `send-file-paths` 參數指定 10 個檔案。下列範例命令會將`/amzn-s3-demo-source-bucket/file2.txt`位於 Amazon S3 儲存體中名為 `/amzn-s3-demo-source-bucket/file1.txt`和 的檔案傳送至合作夥伴 SFTP 伺服器上的 `/tmp`目錄。若要使用此範例命令，請將 取代`amzn-s3-demo-source-bucket`為您自己的儲存貯體。

```
aws transfer start-file-transfer --send-file-paths /amzn-s3-demo-source-bucket/file1.txt /amzn-s3-demo-source-bucket/file2.txt \
    --remote-directory-path /tmp --connector-id c-1111AAAA2222BBBB3 --region us-east-2
```

若要擷取檔案，請指定 `retrieve-file-paths`和 `local-directory-path` 參數。下列範例會擷取`/my/remote/file2.txt`合作夥伴 SFTP 伺服器上的檔案 `/my/remote/file1.txt`和 ，並將其置於 Amazon S3 位置 /amzn-s3-demo-bucket/*prefix*。若要使用此範例命令，請以您自己的資訊取代 `user input placeholders`。

```
aws transfer start-file-transfer --retrieve-file-paths /my/remote/file1.txt  /my/remote/file2.txt \
   --local-directory-path /amzn-s3-demo-bucket/prefix --connector-id c-2222BBBB3333CCCC4 --region us-east-2
```

上述範例會在 SFTP 伺服器上指定絕對路徑。您也可以使用相對路徑：也就是相對於 SFTP 使用者主目錄的路徑。例如，如果 SFTP 使用者是 `marymajor`，且 SFTP 伺服器上的主目錄是 `/users/marymajor/`，則下列命令會`/amzn-s3-demo-source-bucket/file1.txt`傳送至 `/users/marymajor/test-connectors/file1.txt`

```
aws transfer start-file-transfer --send-file-paths /amzn-s3-demo-source-bucket/file1.txt \
   --remote-directory-path test-connectors --connector-id c-2222BBBB3333CCCC4 --region us-east-2
```