# 执行蓝牙 FTP 客户端功能

您可以使用 `obexctl` 主菜单中提供的命令验证蓝牙 FTP 客户端功能。

Note

要测试或验证 FTP 服务器功能，不需要测试应用程序。通过客户端连接执行 FTP 功能。

在开始之前，请按照[设置设备以使用蓝牙 FTP 功能](https://docs.qualcomm.com/doc/80-70018-13SC/topic/bluez-ftp.html#section-bdh-4fl-rcc-navyanka-09-11-24-025-48-587)中所述设置设备。

## 创建文件夹

要在远程设备上创建文件夹，请从 `obexctl` 菜单运行以下命令：

mkdir <folder_name>
    Copy to clipboard

您可以验证服务器上 `/var/bluetooth` 目录中的文件夹创建情况。

**参数**

`<folder_name>` 是新文件夹名称。

**示例**

请运行以下命令，以便创建名为 `new_dir` 的文件夹：

mkdir new_dir
    Copy to clipboard

**示例输出**

#mkdir new_dir
    Attempting to CreateFolder
    CreateFolder successful
    Copy to clipboard

## 更改当前文件夹

要更改远程设备的当前文件夹，请从 `obexctl` 菜单运行以下命令：

cd <folder_path>
    Copy to clipboard

**参数**

`<folder_path>` 是您打算切换至的文件夹。

**示例**

要将当前文件夹更改为 `new_dir`，请运行以下命令：

cd new_dir
    Copy to clipboard

**示例输出**

#cd new_dir
    Attempting to ChangeFolder to new_dir
    ChangeFolder successful
    Copy to clipboard

## 获取当前文件夹信息

要获取有关当前文件夹的信息，请从 `obexctl` 菜单运行以下命令：

ls .
    Copy to clipboard

**示例输出**

# ls .
    Attempting to ListFolder
    [NEW] Transfer /org/bluez/obex/client/session7/transfer4
    [CHG] Transfer /org/bluez/obex/client/session7/transfer4 Size: 611
    [CHG] Transfer /org/bluez/obex/client/session7/transfer4 Status: complete
          Type: folder
          Name: My_folder
          User-perm: RWD
          Group-perm: R
          Other-perm:
          Accessed: 20231214T123503Z
          Modified: 20231214T123502Z
          Created: 20231214T123502Z
          Type: folder
          Name: new_dir
          User-perm: RWD
          Group-perm: R
          Other-perm:
          Accessed: 20231215T093311Z
          Modified: 20231215T093245Z
          Created: 20231215T093245Z
    Copy to clipboard

## 将文件复制至远程设备

要将本地文件复制到远程设备，请从 `obexctl` 菜单运行以下命令：

cp :<source_file> <destination_file>
    Copy to clipboard

**参数**

- `<source_file>` 是本地文件。
- `<destination_file>` 是远程设备上的目标文件。

**示例**

要将 `Documents/ftp_client.txt` 处的本地文件复制到远程设备上的 `ftp_client.txt`，请运行以下命令：

cp :Documents/ftp_client.txt ftp_client.txt
    Copy to clipboard

**示例输出**

# cp :Documents/ftp_client.txt ftp_client.txt
    Attempting to PutFile
    [NEW] Transfer /org/bluez/obex/client/session7/transfer5
    Transfer /org/bluez/obex/client/session7/transfer5
          Status: queued
          Name: ftp_client.txt
          Size: 10
          Filename: Documents/ftp_client.txt
          Session: /org/bluez/obex/client/session7
    [CHG] Transfer /org/bluez/obex/client/session7/transfer5 Status: complete
    [DEL] Transfer /org/bluez/obex/client/session7/transfer5
    Copy to clipboard

## 从远程设备复制文件

开始之前，[将当前文件夹](https://docs.qualcomm.com/doc/80-70018-13SC/topic/bluez-perform-bluetooth-ftp-server-and-client-functions.html#section-h1b-y3l-rcc-navyanka-09-11-24-051-31-148)更改为所需文件的文件夹。

要将文件从远程设备复制到本地目录，请从 `obexctl` 菜单运行以下命令：

cp <destination_file> :<source_file>
    Copy to clipboard

**参数**

- `<source_file>` 是远程设备上的文件。
- `<destination_file>` 是本地设备上的目标文件。

**示例**

要将 `ftp_client_2.txt` 文件从远程设备复制到本地设备，请运行以下命令：

cp ftp_client_2.txt :ftp_client_2.txt
    Copy to clipboard

**示例输出**

# cp ftp_client_2.txt :ftp_client_2.txt
    Attempting to GetFile
    [NEW] Transfer /org/bluez/obex/client/session7/transfer21
    Transfer /org/bluez/obex/client/session7/transfer21
          Status: queued
          Name: ftp_client_2.txt
          Size: 0
          Filename: ftp_client_2.txt
          Session: /org/bluez/obex/client/session7
    [CHG] Transfer /org/bluez/obex/client/session7/transfer21 Size: 13
    [CHG] Transfer /org/bluez/obex/client/session7/transfer21 Status: complete
    [DEL] Transfer /org/bluez/obex/client/session7/transfer21
    Copy to clipboard

## 在远程设备中复制文件

要将文件从远程设备上的一个目录复制到另一个目录，请从 `obexctl` 菜单运行以下命令：

cp <source_file> <destination_file>
    Copy to clipboard

**参数**

- `<source_file>` 是您要复制的文件。
- `<destination_file>` 为目标位置。

**示例**

要将 `ftp_client.txt` 复制到 `/new_dir_2/`，请运行以下命令：

cp ftp_client.txt ../new_dir_2/ftp_client.txt
    Copy to clipboard

**示例输出**

# cp ftp_client.txt ../new_dir_2/ftp_client.txt
    Attempting to CopyFile
    CopyFile successful
    Copy to clipboard

## 移动文件

要将文件从一个文件夹移动到另一个文件夹，请从 `obexctl` 菜单运行以下命令：

mv <source_file> <destination_file>
    Copy to clipboard

**参数**

- `<source_file>` 是您要移动的文件。
- `<destination_file>` 为目标位置。

**示例**

要将 `ftp_client_2.txt` 文件移动到 `/new_dir_2/`，请运行以下命令：

mv ftp_client_2.txt ../new_dir_2/ftp_client_2.txt
    Copy to clipboard

**示例输出**

#mv ftp_client_2.txt ../new_dir_2/ftp_client_2.txt
    Attempting to MoveFile
    MoveFile successful
    Copy to clipboard

## 删除文件

要删除文件，请从 `obexctl` 菜单运行以下命令：

rm <filename>
    Copy to clipboard

**参数**

`<filename>` 是您要删除的文件。

**示例**

要删除 `ftp_client.txt` 文件，请运行以下命令：

rm ftp_client.txt
    Copy to clipboard

**示例输出**

# rm ftp_client.txt
    Attempting to Delete
    Delete successful
    Copy to clipboard

Last Published: Apr 30, 2025

[Previous Topic
文件传输协议 (File Transfer Protocol)](https://docs.qualcomm.com/bundle/publicresource/80-70018-13SC/topics/bluez-ftp.md) [Next Topic
电话簿访问 Profile (Phone Book Access Profile)](https://docs.qualcomm.com/bundle/publicresource/80-70018-13SC/topics/bluez-pbap.md)