- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
04-File Management Configuration | 94.28 KB |
Contents
Performing directory operations
Displaying directory information
Displaying the current working directory
Changing the current working directory
Displaying the contents of a file
Restoring a file from the recycle bin
Performing storage medium operations
Managing the space of a storage medium
Displaying and maintaining the NAND flash memory
File management
This chapter includes these sections:
· Performing directory operations
· Performing storage medium operations
|
NOTE: · The term "switch" or "device" in this chapter refers to the switching engine on a WX3000E wireless switch. · The WX3000E series comprises WX3024E and WX3010E wireless switches. · The port numbers in this chapter are for illustration only. |
Managing files
Files such as host software and configuration files that are necessary for the operation of the device are saved in the storage media of the device. You can manage files on your device through these operations: Performing directory operations, Performing file operations, Performing batch operations, Performing storage medium operations, and Setting prompt modes.
Filename formats
When you specify a file, you must enter the filename in one of the following formats.
Filename formats:
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 the specified folder in the current working directory. path indicates the name of the folder. You can specify multiple folders, indicating a file under a multi-level folder. |
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 the specified storage medium on the device. drive 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. |
Performing directory operations
You can perform an extensive set of directory operations, such creating or removing a directory, displaying the current working directory, displaying a specific directory, or displaying file information.
Displaying directory information
To do… |
Use the command… |
Remarks |
Display directory or file information |
dir [ /all ] [ file-url ] |
Required Available in user view |
Displaying the current working directory
To do… |
Use the command… |
Remarks |
Display the current working directory |
pwd |
Required Available in user view |
Changing the current working directory
To do… |
Use the command… |
Remarks |
Change the current working directory |
cd { directory | .. | / } |
Required Available in user view |
Creating a directory
To do… |
Use the command… |
Remarks |
Create a directory |
mkdir directory |
Required Available in user view |
Removing a directory
To do… |
Use the command… |
Remarks |
Remove a directory |
rmdir directory |
Required Available in user view |
|
NOTE: · Before you remove a directory, you must delete all the files and the subdirectory in this directory. To delete a file, see the delete command; to delete a subdirectory, see the rmdir command. · The rmdir command automatically deletes the files in the recycle bin in the current directory. |
Performing file operations
You can display the specified directory or file information; display file contents; rename, copy, move, remove, restore, and delete files.
|
NOTE: You can create a file by copying, downloading or using the save command. |
Displaying file information
To do… |
Use the command… |
Remarks |
Display file or directory information |
dir [ /all ] [ file-url ] |
Required Available in user view |
Displaying the contents of a file
To do… |
Use the command… |
Remarks |
Display the contents of a file |
more file-url |
Required Currently only a .txt file can be displayed. Available in user view |
Renaming a file
To do… |
Use the command… |
Remarks |
Rename a file |
rename fileurl-source fileurl-dest |
Required Available in user view |
Copying a file
To do… |
Use the command… |
Remarks |
Copy a file |
copy fileurl-source fileurl-dest |
Required Available in user view |
Moving a file
To do… |
Use the command… |
Remarks |
Move a file |
move fileurl-source fileurl-dest |
Required Available in user view |
Deleting a file
To do… |
Use the command… |
Remarks |
Move a file to the recycle bin or delete it permanently |
delete [ /unreserved ] file-url |
Required Available in user view |
|
CAUTION: · The files in the recycle bin still occupy storage space. To delete a file in the recycle bin, execute the reset recycle-bin command in the directory to which the file originally belongs. To save storage space, empty the recycle bin periodically with the reset recycle-bin command. · The delete /unreserved file-url command deletes a file permanently and the action cannot be undone. Using this command equals using the delete file-url command and the reset recycle-bin command in the same directory. |
Restoring a file from the recycle bin
To do… |
Use the command… |
Remarks |
Restore a file from the recycle bin |
undelete file-url |
Required Available in user view |
Emptying the recycle bin
To do… |
Use the command… |
Remarks |
Enter the original working directory of the file to be deleted |
cd { directory | .. | / } |
Optional If the original directory of the file to be deleted is not the current working directory, this command is required. Available in user view |
Delete the file in the current directory and in the recycle bin |
reset recycle-bin [ /force ] |
Required Available in user view |
Performing batch operations
A batch file is a set of executable commands. Executing a batch file is the same as executing the commands in the batch file one by one.
Before executing a batch file, edit the batch file on your PC, and then download it to the device. If the suffix of the file is not .bat, use the rename command to change the suffix to .bat.
Follow these steps below to execute a batch file:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Execute a batch file |
execute filename |
Required |
|
CAUTION: 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, this command fails to be executed, and the system skips to the next one. |
Performing storage medium operations
Managing the space of a storage medium
When the space of a storage medium becomes inaccessible, you can use the fixdisk command to restore the space of the storage medium. The format command formats the storage medium, and all the data on the storage medium is deleted.
Use the following commands to manage the space of a storage medium:
To do… |
Use the command… |
Remarks |
Restore the space of a storage medium |
fixdisk device |
Optional Available in user view |
Format a storage medium |
format device |
Optional Available in user view |
|
CAUTION: When you format a storage medium, all the files stored 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. |
Displaying and maintaining the NAND flash memory
The physical space of the NAND flash memory is divided into multiple blocks, each of which is subdivided into multiple pages. The NAND flash memory is erased on a block basis and read on a page basis; the memory spaces are allocated on a page basis.
Displaying and repairing bad blocks
Bad block ratio varies with products of different vendors. Bad blocks cannot be used to store data, and the system has to skip the bad blocks when it allocates storage spaces to files. You can get the locations of bad blocks and repair them at the command line interface.
Follow these steps to display and repair bad blocks:
To do… |
Use the command… |
Remarks |
Display the number and location of bad blocks in the NAND flash memory |
display nandflash badblock-location [ | { begin | exclude | include } regular-expression ] |
Required Available in any view |
Repair bad blocks |
fixdisk device |
Required Available in user view |
Checking files
After files are written to the NAND flash memory, use the following commands together to check the content of these files.
Follow these steps to check files:
To do… |
Use the command… |
Remarks |
Display the space distribution of the specified file in the NAND flash memory |
display nandflash file-location filename [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display data on the specified physical page |
display nandflash page-data page-value [ | { begin | exclude | include } regular-expression ] |
Setting prompt modes
The system provides the following prompt modes:
· alert: The system warns you about operations that may cause problems such as file corruption and data loss. To prevent incorrect operations, the alert mode is preferred.
· quiet: The system does not prompt confirmation for any operation.
Follow these steps to set a prompt mode:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Set the operation prompt mode of the file system |
file prompt { alert | quiet } |
Optional The default is alert. |
Example for file operations
# Display the files and the subdirectories in the current directory.
<Sysname> dir
Directory of flash:/
0 drw- - Feb 16 2006 11:45:36 logfile
1 -rw- 1218 Feb 16 2006 11:46:19 config.cfg
2 drw- - Feb 16 2006 15:20:27 test
3 -rw- 184108 Feb 16 2006 15:30:20 aaa.bin
97920 KB total (63790 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
97920 KB total (63790 KB free)
# Return to the upper directory.
<Sysname> cd ..
# Display the current working directory.
<Sysname> pwd