File System AT Commands
Note
The File System AT commands are enable by default and cannot be disabled.
AT+FS
command performs corresponding operations in theAT
directory of the file system.AT+CERT
command performs corresponding operations in theCERT
directory of the file system.AT+FSRGN
command configures the file system region for the above command operations.If you want to preload files, refer to Preload Example.
Prior to performing file write operations, validate both file system available capacity and dynamic memory free space to ensure sufficient resource allocation.
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 the directory:
AT+FS=0 OK
Delete the 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 the file
log.txt
starting at offset 100:AT+FS=3,"log.txt",100,50 +FS: <read data> OK
Write 100 bytes of data to the 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
: Client1
: Server
- <index>:
Certificate component index
Range: 1~10
Error Codes
1: Parameter error
AT+FSRGN
Function Description
Configure the file system command operation region.
Command Format
AT+FSRGN=<vfs region>
Response Format
Successful Response:
OK
Error Response:
ERROR: <error_no>
Parameters
- <vfs region>:
File system region - 1: region 1 - 2: region 2
Error Codes
1: Parameter error