File System AT Commands

Note

The File System AT commands are enable by default and cannot be disabled.

AT+FS commands perform corresponding operations in the AT directory of the file system.

AT+CERT commands perform corresponding operations in the CERT directory of the file system.

If you want to preload files, please refer to Preload Example

AT+FS

Function Description

Perform file system operations, including deleting files, reading files, writing files, getting file sizes, and listing files.

Command Format

AT+FS=<operation>[,<filename>,<offset>,<length>]

Response Format

Successful Response:

OK

Error Response:

ERROR: <error_no>

Parameters

  • <operation>: File operation type
    • 0: List files in directory

    • 1: Delete file

    • 2: Get file size

    • 3: Read file

    • 4: Write file

  • <filename>: File name string
    • Length not exceeding 125 bytes

  • <offset>: Starting position for reading or writing

  • <length>: Length to read or write

Error Codes

  • 1: Format error

  • 2: Operation failed

Note

When <operation> is set to write, the system will enter Transparent Transmission (TT) Mode mode.

Examples

List files in directory:

AT+FS=0

OK

Delete file “test.txt”:

AT+FS=1,"test.txt"

OK

Get size of file “data.bin”:

AT+FS=2,"data.bin"
+FS: 1024

OK

Read 50 bytes from file “log.txt” starting at offset 100:

AT+FS=3,"log.txt",100,50
+FS: <read data>

OK

Write 100 bytes of data to file “new.dat”:

AT+FS=4,"new.dat",0,100
>>>
<send 100 bytes of data>

OK

AT+CERT

Function Description

Query the certificate components of the server or client.

Command Format

AT+CERT=<role>,<index>

Response Format

Successful Response:

<Certificate name 1>
<Certificate content 1>

<Certificate name 2>
<Certificate content 2>

<Certificate name 3>
<Certificate content 3>

OK

Error Response:

ERROR: <error_no>

Parameters

  • <role>Certificate component type
    • 0: Client

    • 1: Server

  • <index>Certificate component index
    • Range: 1~10

Error Codes

  • 1: Parameter error