File System

The xPico 200 series embedded Wi-Fi IoT gateway uses a flash file system to store files. The file system is used when the module acts as an HTTP server to serve webpages and other static content. The file system is also used to store user runtime data.

File system operations such as reading, writing, and moving files can be done using the Web Manager, CLI, or file system Web APIs.

File System Statistics

The file system statistics display current usage information. In addition to viewing statistics and status, you can perform two maintenance tasks: compact and format. See Compacting the File System and Formatting the File System below.

To view statistics, use either the Web Manager or CLI.

For Web Manager, go to File System > Status.

For the CLI, see Status File System level.

The following commands are available from the "Status File System" level:

CLI Command Action
show Show the current status.
compact Compact reorganizes data on the flash file system, recovering dirty space. File data is retained. Compacting happens automatically when attempting to write and no clean space is available, but dirty space is available.
format Format clears the flash file system, preserving only system configuration data. All other files are destroyed.

Working with Directories

The following Web Manager commands are available to manipulate directories:

UI Command Action
Change Directory Change the current working directory.
You can also change the directory by clicking the folder name next to the folder icon fs-folder-icon in the file system tree structure.
Create Directory Create a new directory.
fs-delete-icon (Delete Directory) Delete an existing directory. This will also delete all contents in the directory.

The following CLI commands are available to manipulate directories:

CLI Command Action
pwd Print current working directory.
tree [path] View all files and directories from the specified directory down.
cd <path> Change the current directory.
mkdir <directory> Create a directory.
rmdir <directory> Remove a directory.

The following Web API HTTP requests are available to manipulate directories:

HTTP Request Action
HTTP GET Read a directory.
HTTP MKCOL Create a directory.
HTTP DELETE Delete a directory.

Working with Files

The Web Manager, CLI and Web API all provide commands to work with files.

  • Both the maximum file name and maximum path length are 100 characters.
  • The maximum directory depth is 6. File or directory names may only contain letters, numbers, and the following special characters: ~ ( ) _ - { } [ ] . Separate file and directory names with / or \.

Web Manager

The following Web Manager commands are available to manipulate files:

UI Command Action
Change Directory (to view files) Change the current working directory by clicking the folder name next to the folder icon folder icon in the file system tree structure.
Upload File Upload a file.
Copy or Move File Copy or move a file to a different directory.
file system delete icon (Delete File) Delete an existing file.

CLI

The following CLI commands are available to manipulate files:

CLI Command Action
stat [file] Display file or file system statistics.
cat <file> Display the file.
cp <source> <destination> Copy the file to a different directory.
hexdump <file> Display the file in hexadecimal format.
ls [path] List files and directories in the specified directory.
mv <source> <destination> Rename a file or directory.
rm <file> Remove a file from the file system.
tree [path] View all files and directories from the specified directory down.
upload [-a] <filename> Upload a file. -a appends to the existing file.

Web API

The following Web API HTTP requests are available to manipulate files:

HTTP Request Action
HTTP GET Read the contents of a file.
HTTP PUT Upload a file or overwrite a file of the same name.
HTTP DELETE Delete a file.

Formatting the File System

Formatting clears the flash file system, preserving only system configuration data. All other files are destroyed.

For Web Manager, go to File System > Status and click Format.

For the CLI, see Status File System level.

From the status File System level, type Format.

Compacting the File System

Compacting the file system reorganizes data on the flash file system, recovering dirty space while preserving all files. The file data is retained. Compacting also happens automatically when attempting to write to the file system and clean space is not available.

For Web Manager, go to File System > Status and click Compact.

For the CLI, see Status File System level.

From the status File System level, type Compact.