- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
04-File System Management Configuration | 83.36 KB |
Displaying the contents of a file
Displaying directory information
Displaying the current working directory
Changing the current working directory
Setting the file system operation mode
File system management examples
Overview
This chapter describes how to manage the device's file system, including the storage media, directories, and files.
File name formats
When you specify a file, enter the file name in one of the formats shown in Table 1. The similar rules apply to directory names.
Format |
Description |
Length |
Example |
file-name |
Specifies a file in the current working directory. |
1 to 91 characters |
a.cfg indicates a file named a.cfg in the current working directory. |
path/file-name |
Specifies a file in a specific folder in the current working directory. The path argument represents the path to the file. If the file is in a single-level folder, specify the folder name for the argument. If the file is in a nested folder, separate each folder name by a forward slash (/). |
1 to 135 characters |
test/a.cfg indicates a file named a.cfg in the test folder in the current working directory. |
drive:/[path]/file-name |
Specifies a file in a specific storage medium on the device. The drive argument represents the storage medium name, typically flash or cf. If the device has only one storage medium, you do not need to specify the storage medium. If the device has multiple storage media, you must provide the storage medium name. |
1 to 135 characters |
flash:/test/a.cfg indicates a file named a.cfg in the test folder of the Flash root directory. |
Managing files
You can display directory and file information, display file contents, and rename, copy, move, remove, restore, and delete files.
The copy operation enables you to create a file. You can also create a file by performing the download operation or using the save command.
Displaying file information
Perform this task in user view.
Task |
Command |
Display file or directory information. |
dir [ /all ] [ file-url | /all-filesystems ] |
Displaying the contents of a file
Perform this task in user view.
Task |
Command |
Remarks |
Display the contents of a file. |
more file-url |
Only text files can be displayed. |
Renaming a file
Perform this task in user view.
Task |
Command |
Rename a file. |
rename fileurl-source fileurl-dest |
Copying a file
Perform this task in user view.
Task |
Command |
Copy a file. |
copy fileurl-source fileurl-dest |
Moving a file
Perform this task in user view.
Task |
Command |
Move a file. |
move fileurl-source fileurl-dest |
Deleting/restoring a file
You can delete a file permanently or move it to the recycle bin. A file moved to the recycle bin can be restored, but a permanently deleted file cannot.
A file in the recycle bin occupies storage space. To release the occupied space, execute the reset recycle-bin command in the directory that holds the file. To save storage space, periodically empty the recycle bin with the reset recycle-bin command.
Perform the following tasks in user view:
Task |
Command |
Delete a file by moving it to the recycle bin. |
delete file-url |
Restore a file from the recycle bin. |
undelete file-url |
Delete a file permanently. |
delete /unreserved file-url |
Emptying the recycle bin
Step |
Command |
Remarks |
1. Enter the original working directory of the file to be deleted in user view. |
cd { directory | .. | / } |
Skip this step if the original directory of the file is the current working directory. |
2. Empty the recycle bin. |
reset recycle-bin [ /force ] |
N/A |
Managing directories
You can create or remove a directory, display or change the current working directory, and display a specific directory.
Displaying directory information
Perform this task in user view.
Task |
Command |
Display directory or file information. |
dir [ /all ] [ file-url | /all-filesystems ] |
Displaying the current working directory
Perform this task in user view.
Task |
Command |
Display the current working directory. |
pwd |
Changing the current working directory
Perform this task in user view.
Task |
Command |
Change the current working directory. |
cd { directory | .. | / } |
Creating a directory
Perform this task in user view.
Task |
Command |
Create a directory. |
mkdir directory |
Removing a directory
To remove a directory, you must delete all files and subdirectories in this directory. To delete a file, use the delete command. To delete a subdirectory, use the rmdir command.
Removing a directory permanently deletes all its files in the recycle bin, if any.
Perform this task in user view.
Task |
Command |
Remove a directory. |
rmdir directory |
Managing storage medium space
|
CAUTION: After a storage medium is formatted, all files on it are erased and cannot be restored. If a startup configuration file exists on the storage medium, formatting the storage medium results in loss of the startup configuration file. |
If part of a storage medium is inaccessible, use the fixdisk command to examine the medium for any damage and repair the medium.
To manage the space of a storage medium, perform one of the following tasks in user view:
Task |
Command |
Repair a storage medium. |
fixdisk device |
Format a storage medium. |
format device |
Performing batch operations
A batch file comprises a set of executable commands. Executing a batch file is the same as executing the commands one by one. However, execution of a batch file does not guarantee successful execution of every command in the batch file. If a command has error settings or the conditions for executing the command are not satisfied, the system skips this command.
You can edit a batch file on your PC, and then upload or download it to the device. If the extension of the file is not .bat, use the rename command to change it to .bat.
To execute a batch file:
Step |
Command |
1. Enter system view. |
system-view |
2. Execute a batch file. |
execute filename |
Setting the file system operation mode
The file systems support the following operation modes:
· alert—The system warns you about operations that might cause problems such as file corruption and data loss. To prevent incorrect operations, use the alert mode.
· quiet—The system does not prompt for any operation confirmation.
To set the file system operation mode:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Set the file system operation mode. |
file prompt { alert | quiet } |
Optional. The default is alert. |
File system management examples
# Display the files and the subdirectories in the current directory.
<Sysname> dir
Directory of flash:/
0 -rw- 1344 Jun 12 2013 03:08:40 startup.cfg
1 -rw- 188 Jun 12 2013 03:08:36 system.xml
2 -rw- 10313004 Aug 08 2008 20:00:00 wa4600_fat.bin
15057 KB total (4934 KB free)
# Create new folder mytest in the test directory.
<Sysname> cd test
<Sysname> mkdir mytest
%Created dir flash:/test/mytest.
# Display the current working directory.
<Sysname> pwd
flash:/test
# Display the files and the subdirectories in the test directory.
<Sysname> dir
Directory of flash:/test/
0 drw- - Feb 16 2006 15:28:14 mytest
2540 KB total (2519 KB free)
# Return to the upper directory.
<Sysname> cd ..
# Display the current working directory.
<Sysname> pwd