This command allows to perform operations with the file system of the XBee 3 BLU device. The FS command requires the use of sub-commands to execute any operation. These subcommands are arguments to the FS command, like ATFS PWD.

FS (File System)

When sent without any parameters, FS prints a list of supported commands.

FS PWD

Prints the current working directory, which always starts with / and defaults to /flash at startup.

FS CD directory

Changes the current working directory to directory. Prints the current working directory or an error if unable to change to directory.

FS MD directory

Creates the directory directory. Prints OK if successful or an error if unable to create the requested directory.

FS LS [directory]

Lists files and directories in the specified directory. The directory parameter is optional and defaults to a period ., which represents the current directory. The list ends with a blank line.

Entries start with zero or more spaces, followed by file size or the string <DIR> for directories, then a single space character and the name of the entry. Directory names end with a forward slash / to differentiate them from files.

<DIR> ./
<DIR> ../
<DIR> lib/
  32 test.txt

FS PUT filename

Starts a YMODEM receive on the XBee 3 BLU, storing the received file to filename and ignoring the filename that appears in block 0 of the YMODEM transfer. The XBee 3 BLU sends a prompt (Receiving file with YMODEM…​) when it is ready to receive, at which point you should initiate a YMODEM send in your terminal emulator.

If the command is incorrect, the reply will be an error as described in Error responses.

To learn more about YMODEM, feel free to check out any of the following pages:

FS HASH filename

Print a SHA-256 hash of the given file specified by filename to allow for verification against a local copy of the file.

On Windows, you can generate a SHA-256 hash of a file with the command certutil -hashfile test.txt SHA256.+ On Mac and Linux use shasum -b -a 256 test.txt.

FS GET filename

Starts a YMODEM send of filename on the XBee device. When it is ready to send, the XBee 3 BLU sends a prompt: (Sending file with YMODEM…​). When the prompt is sent, you should initiate a YMODEM receive in your terminal emulator.

If the command is incorrect, the reply will be an error as described in Error responses.

FS RM file_or_directory

Removes the file or empty directory specified by file_or_directory. This command fails with an error if file_or_directory does not exist, is not empty or refers to the current working directory or one of its parents.

  • Removing a file only reclaims space if the file removed is placed last in the file system.

  • Deleted data that is contiguous with the last deleted file is also reclaimed.

  • Directories are only reclaimed if all directories in that particular block of memory are deleted and found at the end of the file system.

Use the ATFS INFO FULL command to see where in the file system files and directories are placed.

FS INFO

Report on the size of the filesystem, showing bytes in use, available, marked bad and total. The report ends with a blank line, as with most multi-line AT command output. Example output:

204800 used
 695296 free
     0 bad
 900096 total

FS INFO FULL

Reports every file and directory in the order they are placed in the file system along with the amount of space they take up individually. Also reports deleted space as well as unused directory slots. Example output:

128 /flash./
128 /flash/lib./
128 /flash/directory./
1664 [unused dir slot(s)]
2048 /flash/file1.txt.
2048 [deleted space]
2048 /flash/directory/file2.txt

FS FORMAT confirm

Formats the file system, leaving it with a default directory structure. Pass the word confirm as the first parameter to confirm the format. The XBee 3 BLU responds with Formatting…​ when the format starts, and will print OK followed by a carriage return when it finishes.

Error responses

If a command succeeds it returns information such as the name of the current working directory or a list of files, or OK if there is no information to report. If it fails, you see a detailed error message instead of the typical ERROR response for a failing AT command. The response is a named error code and a textual description of the error.

The exact content of error messages may change in the future.

All errors start with a uppercase E, followed by one or more uppercase letters and digits, a space, and an description of the error. If writing your own AT command parsing code, you can determine if an FS command response is an error by checking if the first letter of the response is uppercase E.