AT Commands For File System
The file system is used to store files in a hierarchical (tree) structure, and there are some definitions and conventions to use the Module.
Local storage space is mapped to “C:”, “D:” for TF card, “E:” for multimedia, “F:” for cache.
NOTE
General rules for naming (both directories and files):
The length of actual fully qualified names of directories and files can not exceed 254.
Directory and file names can not include the following characters: \ : * ? ” <> | , ;
Between directory name and file/directory name, use character “/” as list separator, so it can not appear in directory name or file name.
The first character of names must be a letter or a numeral or underline, and the last character can not be period “.” and oblique “/”.
No | Command | Description |
F2201 | AT+FSCD | Select directory as current directory |
F2202 | AT+FSMKDIR | Make new directory in current directory |
F2203 | AT+FSRMDIR | Delete directory in current directory |
F2204 | AT+FSLS | List directories/files in current directory |
F2205 | AT+FSDEL | Delete file in current directory |
F2206 | AT+FSRENAME | Rename file in current directory |
F2207 | AT+FSATTRI | Request file attributes |
F2208 | AT+FSMEM | Check the size of available memory |
F2209 | AT+FSLOCA | Select storage place |
F2210 | AT+FSCOPY | Copy an appointed file |
F2211 | AT+CFTRANRX | Transfer a file to EFS |
F2212 | AT+CFTRANTX | Transfer a file from EFS to host |
F2201 AT+FSCD Select Directory As Current Directory
This command is used to select a directory. The Module supports absolute path and relative path.
Read Command will return current directory without double quotation marks. Support “C:”, “D:”, “E:”, “F:”.
T) AT+FSCD=? | OK |
R) AT+FSCD? |
+FSCD: <curr_path> OK |
W) AT+FSCD=<path> |
+FSCD: <curr_path> OK or ERROR |
<path> | String without double quotes, directory for selection. |
<curr_path> | String without double quotes, current directory. |
NOTE
If <PATH> is “..”, it will go back to previous level of directory.
Example |
AT+FSCD=C: +FSCD: C:/ OK AT+FSCD=C:/ +FSCD: C:/ OK AT+FSCD? +FSCD: C:/ OK AT+FSCD=.. +FSCD: C:/ OK AT+FSCD=D: +FSCD: D:/ OK AT+FSCD? +FSCD: D:/ OK |
F2202 AT+FSMKDIR Make New Directory In Current Directory
This command is used to create a new directory in current directory. Support “C:”, “D:”, “E:”, “F:”.
T) AT+FSMKDIR=? | OK |
W) AT+FSMKDIR=<dir> |
OK or ERROR |
<dir> | String without double quotes, directory name which does not already exist in current directory. |
Example |
AT+FSMKDIR=SIMTech OK AT+FSCD? +FSCD: E:/ OK AT+FSLS +FSLS: SUBDIRECTORIES Audio SIMTech OK |
F2203 AT+FSRMDIR Delete Directory In Current Directory
This command is used to delete existing directory in current directory. Support “C:”, “D:”, “E:”, “F:”.
T) AT+FSRMDIR=? | OK |
W) AT+FSRMDIR=<dir> |
OK or ERROR |
<dir> | String without double quotes. |
Example |
AT+FSRMDIR=SIMTech OK AT+FSCD? +FSCD: E:/ OK AT+FSLS +FSLS: SUBDIRECTORIES Audio OK |
F2204 AT+FSLS List Directories/Files In Current Directory
This command is used to list information of directories and/or files in current directory. Support “C:”, “D:”, “E:”, “F:”.
T) AT+FSLS=? |
+FSLS: (list of supported <type>) OK |
R) AT+FSLS? |
+FSLS: SUBDIRECTORIES<dir_num>,FILES:<file_num> OK |
W) AT+ FSLS=<type> |
[+FSLS: SUBDIRECTORIES: <list of subdirectories> <CR><LF>] [+FSLS: FILES: <list of files> <CR><LF>] OK |
E) AT+ FSLS |
[+FSLS: SUBDIRECTORIES: <list of subdirectories> <CR><LF>] [+FSLS: FILES: <list of files> <CR><LF>] OK |
<dir_num> | Integer type, the number of subdirectories in current directory. |
<file_num> | Integer type, the number of files in current directory. |
<type> |
0 list both subdirectories and files 1 list subdirectories only 2 list files only |
Example |
AT+FSLS? +FSLS: SUBDIRECTORIES:2,FILES:2 OK AT+FSLS +FSLS: SUBDIRECTORIES: FirstDir SecondDir +FSLS: FILES: image_0.jpg image_1.jpg OK AT+FSLS=2 +FSLS: FILES: image_0.jpg image_1.jpg OK |
F2205 AT+FSDEL Delete File In Current Directory
This command is used to delete a file in current directory.
Before do that, it needs to use AT+FSCD select the father directory as current directory. Support “C:”, “D:”, “E:”, “F:”.
T) AT+FSDEL=? | OK |
W) AT+FSDEL=<filename> |
OK or ERROR |
<filename> |
String with or without double quotes, file name which is relative and already existing. If <filename> is *.*, it means delete all files in current directory. If the file path contains non-ASCII characters, the filename parameter should contain a prefix of {non-ascii} and the quotation mark. |
Example |
AT+FSDEL=image_0.jpg OK |
F2206 AT+FSRENAME Rename File In Current Directory
This command is used to rename a file in current directory. Support “C:”, “D:”, “E:”, “F:”.
T) AT+FSRENAME=? | OK |
W) AT+FSRENAME=<old_name>,<new_name> |
OK or ERROR |
<old_name> |
String with or without double quotes, file name which is existed in current directory. If the file path contains non-ASCII characters, the file path parameter should contain a prefix of {non-ascii} and the quotation mark. |
<new_name> |
New name of specified file, string with or without double quotes. If the file path contains non-ASCII characters, the file path parameter should contain a prefix of {non-ascii} and the quotation mark. |
Example |
AT+FSRENAME=image_0.jpg, image_1.jpg OK AT+FSRENAME=”mytest.jpg”, {non-ascii}”E6B58BE8AF95E99984E4BBB62E6A7067″ OK |
F2207 AT+FSATTRI Request File Attributes
This command is used to request the attributes of file which exists in current directory. Support “C:”, “D:”, “E:”, “F:”.
T) AT+FSATTRI=? | OK |
W) AT+FSATTRI=<dir> |
+FSATTRI: <file_size>,<create_date> OK or ERROR |
<filename> |
String with or without double quotes, file name which is in current directory. If the file path contains non-ASCII characters, the file path parameter should contain a prefix of {non-ascii} and the quotation mark. |
<file_size> | The size of specified file, and the unit is in Byte. |
<create_date> |
Create date and time of specified file, the format is YYYY/MM/DD HH:MM:SS Week. Week Mon, Tue, Wed, Thu, Fri, Sat, Sun |
Example |
AT+FSATTRI=image_0.jpg +FSATTRI: 8604, 2008/04/28 10:24:46 Tue OK AT+FSATTRI={non-ascii}”E6B58BE8AF95E99984E4BBB62E6A7067″ +FSATTRI: 6296, 2012/01/06 00:00:00 Sun OK |
F2208 AT+FSMEM Check The Size Of Available Memory
This command is used to check the size of available memory.
The response will list total size and used size of local storage space if present and mounted. Support “C:”, “D:”, “E:”, “F:”.
T) AT+FSMEM=? | OK |
W) AT+FSMEM |
+FSMEM: <loctype>:(<total>, <used>) OK |
<loctype> | Support “C:”, “D:”, “E:”, “F:”. |
<total> | The total size of local storage space. The unit of storage space size is in Byte. |
<used> | The used size of local storage space. The unit of storage space size is in Byte. |
Example |
AT+FSMEM +FSMEM: C:(11348480, 2201600) OK |
F2209 AT+FSLOCA Select Storage Place
This command is used to set the storage place for media files. Support “C:”.
T) AT+FSLOCA=? |
+FSLOCA: (list of supported <loca>s) OK |
R) AT+FSLOCA? |
+FSLOCA: <loca> OK |
W) AT+FSLOCA=<loca> |
OK or ERROR |
<loca> | 0 store media files to local storage space (namely “C:/”) |
Example |
AT+FSLOCA=0 OK AT+FSLOCA? +FSLOCA: 0 OK |
F2210 AT+FSCOPY Copy An Appointed File
This command is used to copy an appointed file on C:/ to an appointed directory on C:/, the new file name should give in parameter.
Support “C:”,”D:”, “E:”, “F:”, but copying from “C:” to “D:”, “E:”, “F:” or from “D:”, “E:”, “F:” to “C:” is not supported.
T) AT+FSCOPY=? | OK |
W) AT+FSCOPY=<file1>,<file2> [,<sync_mode>] |
Sync mode +FSCOPY: <percent><CR><LF> [+FSCOPY: <percent><CR><LF>] OK Async mode OK +FSCOPY: <percent><CR><LF> [+FSCOPY: <percent><CR><LF>] +FSCOPY: END<CR><LF> Or When error, shows one of the following errors and ERROR SD CARD NOT PLUGGED IN FILE IS EXISTING FILE NOT EXISTING DIRECTORY IS EXISTED DIRECTORY NOT EXISTED FORBID CREATE DIRECTORY UNDER \”C:/\” FORBID DELETE DIRECTORY INVALID PATH NAME INVALID FILE NAME SD CARD HAVE NO ENOUGH MEMORY EFS HAVE NO ENOUGH MEMORY FILE CREATE ERROR READ FILE ERROR WRITE FILE ERROR ERROR |
<file1> |
The sources file name or the whole path name with sources file name. If the file path contains non-ASCII characters, the file path parameter should contain a prefix of {non-ascii} and the quotation mark. |
<file2> |
The destination file name or the whole path name with destination file name. If the file path contains non-ASCII characters, the file path parameter should contain a prefix of {non-ascii} and the quotation mark. |
<percent> |
The percent of copy done. The range is 0.0 to 100.0 |
<sync_mode> |
The execution mode of the command: 0 synchronous mode 1 asynchronous mode |
NOTE
1.The <file1> and <file2> should give the whole path and name, if only given file name, it will refer to current path (AT+FSCD) and check the file’s validity.
2.If <file2> is a whole path and name, make sure the directory exists, make sure that the file name does not exist
or the file name is not the same name as the sub folder name, otherwise return error.
3.<percent> report refer to the copy file size. The big file maybe report many times, and little file report less.
4.If <sync_mode> is 1, the command will return OK immediately, and report final result with +FSCOPY: END.
Example |
AT+FSCD? +FSCD: C:/ OK AT+FSCOPY= C:/TESTFILE,COPYFILE (Copy file TESTFILE on C:/ to C:/COPYFILE) +FSCOPY: 1.0 +FSCOPY: 100.0 OK AT+FSCOPY= “my test.jpg”, {non-ascii}”E6B58BE8AF95E99984E4BBB62E6A7067″ +FSCOPY:1.0 +FSCOPY:100.0 OK |
F2211 AT+CFTRANRX Transfer A File To EFS
This command is used to transfer a file to EFS. Support SDcard.
T) AT+CFTRANRX=? |
+CFTRANRX: [{non-ascii}]”FILEPATH” OK |
W) AT+CFTRANRX=”<filepath>”,<len> |
> OK or > ERROR or ERROR |
<filepath> | The path of the file on EFS. |
<len> | The length of the file data to send. The range is from 0 to 2147483647. |
NOTE
The <filepath> must be a full path with the directory path.
Example |
AT+CFTRANRX=”c:/MyDir/t1.txt”,10 ><input data here> OK AT+CFTRANRX=”d:/MyDir/t1.txt”,10 ><input data here> OK |
F2212 AT+CFTRANTX Transfer A File From EFS To Host
This command is used to transfer a file from EFS to host.
Before using this command, the AT+CATR must be used to set the correct port used. Support SDcard.
T) AT+CFTRANTX=? |
+CFTRANTX: [{non-ascii}]”FILEPATH” OK |
W) AT+CFTRANTX =”<filepath>”[,<location> ,<size>] |
[+CFTRANTX: DATA,<len> … +CFTRANTX: DATA,<len>] +CFTRANTX: 0 OK or ERROR |
<filepath> | The path of the file on EFS. |
<len> | The length of the following file data to output. |
<location> | The beginning of the file data to output. |
<size> | The length of the file data to output. |
NOTE
The <filepath> must be a full path with the directory path.
Example |
AT+CFTRANTX=”c:/MyDir/t1.txt” OK +CFTRANTX: DATA, 11 Testcontent +CFTRANTX: 0 OK AT+CFTRANTX=”d:/MyDir/t1.txt”,1,4 +CFTRANTX: DATA, 4 estc +CFTRANTX: 0 OK |