- Table of Contents
- Related Documents
-
| Title | Size | Download |
|---|---|---|
| 04-File system management configuration | 85.22 KB |
Displaying directory information
Displaying the current working directory
Changing the current working directory
Setting the file system operation mode
File system management examples
Managing the file system
This chapter introduces the storage medium naming rules and file name formats, and describes how to manage the device's file system, including the storage media, directories, and files.
Storage medium naming rules
If a storage medium is the only storage medium of its type on the device, it is named by its type. For example, if the device has only one Flash, the name of the Flash is flash.
File name formats
When you specify a file, enter the file name in one of the formats shown in Table 1.
|
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. |
1 to 135 characters |
flash:/test/a.cfg indicates a file named a.cfg in the test folder in the root directory of the Flash memory. |
Managing files
|
|
CAUTION: To avoid file system corruption, do not plug in or unplug storage media or perform active/standby switchover while the system is processing a file operation. |
You can display directory or file information; display file contents; 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 file contents
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 just move it to the recycle bin. A file moved to the recycle bin can be restored, but a file permanently deleted 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 to be deleted 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
Before you 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.
The rmdir command automatically deletes the files in the recycle bin in the current directory.
Perform this task in user view.
|
Task |
Command |
|
Remove a directory. |
rmdir directory |
Managing storage media
Storage media management includes space assignment.
Managing storage medium space
When the space of a storage medium becomes inaccessible, you can use the fixdisk command to examine the medium for damage and repair any damage.
The format command formats the storage medium, and all data on the storage medium is deleted.
|
|
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. |
To manage the space of a storage medium, perform the following tasks in user view:
|
Task |
Command |
Remarks |
|
Repair a storage medium. |
fixdisk device |
N/A |
|
Format a storage medium. |
format device |
N/A |
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 drw- - Feb 16 2013 11:45:36 logfile
1 -rw- 1218 Feb 16 2013 11:46:19 config.cfg
2 drw- - Feb 16 2013 15:20:27 test
3 -rw- 184108 Feb 16 2013 15:30:20 aaa.bin
12065 KB total (9076 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 2013 15:28:14 mytest
12065 KB total (9076 KB free)
# Return to the upper directory.
<Sysname> cd ..
# Display the current working directory.
<Sysname> pwd
