- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
04-File Management Commands | 136.97 KB |
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.
In the following examples, the current working directory is the root directory of the storage medium on the device.
For the qualified filename formats, see the chapter “File management configuration.”
cd
Syntax
cd { directory | .. | / }
View
User view
Default level
3: Manage level
Parameters
directory: Name of the target directory, in the format of [drive:/]path. For the detailed introduction to the drive and path arguments, see the Fundamentals Configuration Guide. If no drive information is provided, the argument represents a folder or subfolder in the current directory.
..: Returns to an upper directory. If the current working directory is the root directory, or if no upper directory exists, the current working directory does not change when the cd .. command is executed. This argument does not support command online help.
/: Returns to the root directory of the storage medium. This keyword does not support command line online help.
Description
Use the cd command to change the current working directory.
Examples
# Enter the test folder after logging in to the device.
<Sysname> cd test
# Return to the upper directory (Remember to enter a space after the keyword cd).
<Sysname> cd ..
# Return to the root directory.
<Sysname> cd /
After you change the current directory using the cd command, you can use the pwd command to view the path of the current working directory.
copy
Syntax
copy fileurl-source fileurl-dest
View
User view
Default level
3: Manage level
Parameters
fileurl-source: Name of the source file.
fileurl-dest: Name of the target file or folder.
Description
Use the copy command to copy a file.
If you specify a target folder, the system will copy the file to the specified folder and use the name of the source file as the file name.
Examples
# Copy file testcfg.cfg in the current folder and save it as testbackup.cfg.
<Sysname> copy testcfg.cfg testbackup.cfg
Copy flash:/test.cfg to flash:/testbackup.cfg?[Y/N]:y
....
%Copy file flash:/test.cfg to flash:/testbackup.cfg...Done.
delete
Syntax
delete [ /unreserved ] file-url
View
User view
Default level
3: Manage level
Parameters
/unreserved: Permanently deletes the specified file, and the deleted file can never be restored.
file-url: Name of the file to be deleted. Asterisks (*) are acceptable as wildcards. For example, to remove files with the extension of .txt in the current directory, you may use the delete *.txt command.
Description
Use the delete file-url command to temporarily delete a file. The deleted file is saved in the recycle bin. To restore it, use the undelete command.
The dir /all command displays the files deleted from the current directory and moved to the recycle bin. These files are enclosed in pairs of square brackets [ ]. To remove the files from the recycle bin, use the reset recycle-bin command.
The delete /unreserved file-url command permanently deletes a file, and the deleted file cannot be restored. Use it with caution.
|
CAUTION: If you delete two files with the same filename in different directories, only the last one is retained in the recycle bin. |
Examples
# Remove file tt.cfg from the current directory.
<Sysname> delete tt.cfg
Delete flash:/tt.cfg? [Y/N]:y
.
%Delete file flash:/tt.cfg...Done.
# Remove file tt.cfg from the root directory of the storage medium on the device.
<Sysname> delete tt.cfg
.
Delete flash:/tt.cfg?[Y/N]:y
.
%Delete file flash:/tt.cfg...Done.
dir
Syntax
dir [ /all ] [ file-url ]
View
User view
Default level
3: Manage level
Parameters
/all: Displays all files and folders in the current directory, including hidden files, hidden folders, files moved from the current directory to the recycle bin. Files in the recycle bin are enclosed in square brackets [ ].
file-url: Displays the specified file. Asterisks (*) are acceptable as wildcards. For example, to display files with the .txt extension in the current directory, you may use the dir *.txt command.
Description
Use the dir command to display files or folders.
If no parameter is specified, the command displays all visible files and folders in the current directory.
Examples
# Display information about all files and folders.
<Sysname> dir /all
Directory of flash:/
0 -rwh 4 Apr 26 2008 12:02:05 snmpboots
1 -rw- 10187730 Apr 26 2008 16:47:07 startup.bin
2 -rwh 3144 Apr 26 2008 13:45:35 private-data.txt
3 -rw- 2161 Apr 26 2008 13:53:25 startup.cfg
4 -rw- 10058752 Sep 19 2008 17:41:46 startup_b58.bin
5 -rw- 10139143 Apr 26 2008 13:08:20 startup_b59.bin
6 -rwh 716 Apr 26 2008 12:01:58 hostkey
7 -rwh 572 Apr 26 2008 12:02:11 serverkey
8 -rwh 548 Apr 26 2008 12:02:17 dsakey
9 -rw- 3035 Apr 26 2008 13:45:42 new-config.cfg
10 -rw- 2200 Apr 26 2008 14:58:35 [aa.cfg]
97920 KB total (63790 KB free)
Table 1 Output description
Field |
Description |
Directory of |
The current working directory |
d |
Indicates a directory. If this field does not exist, it indicates a file. |
r |
Indicates that the file or directory is readable. |
w |
Indicates that the file or directory is writable. |
h |
Indicates that the file or directory is hidden. |
[ ] |
Indicates that the file is in the recycle bin. |
display nandflash file-location
Syntax
display nandflash file-location filename [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
2: System level
Parameters
filename: File name.
|: Filters command output by specifying a regular expression. For more information about regular expressions, see the Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, which is a case sensitive string of 1 to 256 characters.
Description
Use the display nandflash file-location command to display the location of the specified file in the NAND flash memory.
The displayed information includes all the physical pages corresponding to the logical pages of the specified file.
WX3010E wireless switches do not support this command.
Examples
# Display the location of the file test.cfg in the NAND flash memory.
<Sysname> display nandflash file-location test.cfg
Logical Chunk Physical Page
---------------------------
chunk(0) 1234
chunk(1) 1236
chunk(2) 1235
filename: test.cfg
Table 2 Output description
Field |
Description |
Logic Chunk |
Serial number of the logical pages |
Physical Page |
Serial number of the physical pages |
chunk(0) 1234 |
The first logical page of this file corresponds to the 1234th physical page on the device. |
display nandflash badblock-location
Syntax
display nandflash badblock-location [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
2: System level
Parameters
|: Filters command output by specifying a regular expression. For more information about regular expressions, see the Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, which is a case sensitive string of 1 to 256 characters.
Description
Use the display nandflash badblock-location command to display the number and location of bad blocks in the NAND flash memory.
WX3010E wireless switches do not support this command.
Examples
# Display the number and location of bad blocks in the NAND flash memory.
<Sysname> display nandflash badblock-location
No Physical block
------------------------------
badblock(0) 1234
badblock(1) 1235
badblock(2) 1236
3200 block(s) total, 3 block(s) bad.
Table 3 Output description
Field |
Description |
No |
Serial number of the bad blocks |
Physical block |
Serial number of the physical pages with bad blocks |
3200 block(s) total, 3 block(s) bad. |
Total number of blocks and bad blocks in the NAND flash memory |
display nandflash page-data
Syntax
display nandflash page-data page-value [ | { begin | exclude | include } regular-expression ]
View
Any view
Default level
1: Monitor level
Parameters
page-value: Serial number of a physical page.
|: Filters command output by specifying a regular expression. For more information about regular expressions, see the Fundamentals Configuration Guide.
begin: Displays the first line that matches the specified regular expression and all lines that follow.
exclude: Displays all lines that do not match the specified regular expression.
include: Displays all lines that match the specified regular expression.
regular-expression: Specifies a regular expression, which is a case sensitive string of 1 to 256 characters.
Description
Use the display nandflash page-data command to display the data on the specified physical page in the NAND flash memory.
This command is always used in combination with the display nandflash file-location command to check the correctness of the data in the NAND flash memory.
WX3010E wireless switches do not support this command.
Examples
# Display the content of the file test.cfg which is saved in the NAND flash memory.
<Sysname> display nandflash file-location test.cfg
Logical Chunk Physical Page
---------------------------
chunk(0) 1234
chunk(1) 1236
chunk(2) 1235
filename: test.cfg
<Sysname> display nandflash page-data 1236
0000: 0D 0A 23 0D 0A 20 76 65 72 73 69 6F 6E 20 35 2E ..#.. version 5.
0010: 32 30 2C 20 41 6C 70 68 61 20 31 30 31 31 0D 0A 20, Alpha 1011..
0020: 23 0D 0A 20 73 79 73 6E 61 6D 65 20 48 33 43 0D #.. sysname H3C.
0030: 0A 23 0D 0A 20 70 61 73 73 77 6F 72 64 2D 63 6F .#.. password-co
...Omitted...
execute
Syntax
execute filename
View
System view
Default level
2: System level
Parameters
filename: Name of a batch file with a .bat extension. You can use the rename command to change the suffix of the configuration file to .bat to use it as a batch file.
Description
Use the execute command to execute the specified batch file.
Batch files are command line files. Executing a batch file is to execute a set of command lines in the file.
Do not include invisible characters in a batch file. If an invisible character is found during the execution, the batch process will abort and the commands that have been executed cannot be cancelled.
Not every command in a batch file is sure to be executed. For example, if a certain command is not correctly configured, the command will fail to be executed, and the system omits this command and goes to the next one.
The configuration generated after a batch file is executed will not be backed up to the standby main board automatically.
Each configuration command in a batch file must be a standard configuration command, meaning that the valid configuration information can be displayed with the display current-configuration command.
Examples
# Execute the batch file test.bat in the root directory.
<Sysname> system-view
[Sysname] execute test.bat
file prompt
Syntax
file prompt { alert | quiet }
View
System view
Default level
3: Manage level
Parameters
alert: Enables the system to warn you about operations that may bring undesirable results such as file corruption or data loss.
quiet: Disables the system from warning you about any operation.
Description
Use the file prompt command to set a prompt mode for file operations.
By default, the prompt mode is alert, which is recommended to avoid mis-operations.
When the prompt mode is set to quiet, the system does not warn for any file operation.
Examples
# Set the file operation prompt mode to alert.
<Sysname> system-view
[Sysname] file prompt alert
fixdisk
Syntax
fixdisk device
View
User view
Default level
3: Manage level
Parameters
device: Storage medium name.
Description
Use the fixdisk command to restore the space of a storage medium when it becomes unavailable because of some abnormal operation.
Examples
# Restore the space of the flash.
<Sysname> fixdisk flash:
Fixdisk flash: may take some time to complete...
%Fixdisk flash: completed.
format
Syntax
format device
View
User view
Default level
3: Manage level
Parameters
device: Name of a storage medium (for example flash).
Description
Use the format command to format a storage medium.
|
CAUTION: Formatting a storage medium results in loss of all the files on the storage medium and these files cannot be restored. In particular, if a startup configuration file exists on a storage medium, formatting the storage medium results in loss of the startup configuration file. |
Examples
# Format the flash.
<Sysname> format flash:
All data on flash: will be lost, proceed with format? [Y/N]:y
./
%Format flash: completed.
mkdir
Syntax
mkdir directory
View
User view
Default level
3: Manage level
Parameters
directory: Name of a folder.
Description
Use the mkdir command to create a folder under a specified directory on the storage medium.
The name of the folder to be created must be unique in the specified directory. Otherwise, you will fail to create the folder in the directory.
To use this command to create a folder, the specified directory must exist. For example, to create folder flash:/test/mytest, the test folder must exist. Otherwise, you will fail to create the mytest folder.
Examples
# Create a folder named test in the current directory.
<Sysname> mkdir test
....
%Created dir flash:/test
# Create folder test/subtest in the current directory.
<Sysname> mkdir test/subtest
....
%Created dir flash:/test/subtest
more
Syntax
more file-url
View
User view
Default level
3: Manage level
Parameters
file-url: File name.
Description
Use the more command to display the contents of the specified file. It indicates that there are more lines that the screen can display.
This command is valid only for text files.
Examples
# Display the contents of file test.txt.
<Sysname> more test.txt
Welcome to H3C.
# Display the contents of file testcfg.cfg.
<Sysname> more testcfg.cfg
#
version 5.20, Beta 1201, Standard
#
sysname Sysname
#
vlan 2
#
return
<Sysname>
move
Syntax
move fileurl-source fileurl-dest
View
User view
Default level
3: Manage level
Parameters
fileurl-source: Name of the source file.
fileurl-dest: Name of the target file or folder.
Description
Use the move command to move a file.
If you specify a target folder, the system will move the source file to the specified folder, with the file name unchanged.
Examples
# Move file flash:/test/sample.txt to flash:/, and save it as 1.txt.
<Sysname> move test/sample.txt 1.txt
Move flash:/test/sample.txt to flash:/1.txt?[Y/N]:y
...
% Moved file flash:/test/sample.txt to flash:/1.txt
# Move file b.cfg to the subfolder test2.
<Sysname> move b.cfg test2
Move flash:/b.cfg to flash:/test2/b.cfg?[Y/N]:y
.
%Moved file flash:/b.cfg to flash:/test2/b.cfg.
pwd
Syntax
pwd
View
User view
Default level
3: Manage level
Parameters
None
Description
Use the pwd command to display the current path.
Examples
# Display the current path.
<Sysname> pwd
flash:
rename
Syntax
rename fileurl-source fileurl-dest
View
User view
Default level
3: Manage level
Parameters
fileurl-source: Name of the source file or folder.
fileurl-dest: Name of the target file or folder.
Description
Use the rename command to rename a file or folder. The target file name must be unique in the current path.
Examples
# Rename file sample.txt as sample.bat.
<Sysname> rename sample.txt sample.bat
Rename flash:/sample.txt to flash:/sample.bat? [Y/N]:y
% Renamed file flash:/sample.txt to flash:/sample.bat
reset recycle-bin
Syntax
reset recycle-bin [ /force ]
View
User view
Default level
3: Manage level
Parameters
/force: Deletes all files in the recycle bin, including files that cannot be deleted by the command without the /force keyword.
Description
Use the reset recycle-bin command to permanently delete the files in the recycle bin in the current directory.
If a file is corrupted, you may not be able to delete the file using the reset recycle-bin command. Use the reset recycle-bin /force command to delete the corrupted file in the recycle bin forcibly.
The delete file-url command only moves a file to the recycle bin. To permanently delete the file in the recycle bin, use the reset recycle-bin command in the original directory of the file.
The reset recycle-bin command deletes files in the current directory and in the recycle bin. If the original path of the file to be deleted is not the current directory, use the cd command to enter the original directory of the file, and then execute the reset recycle-bin command.
Examples
# Delete file b.cfg in the current directory and in the recycle bin.
· Display all the files in the recycle bin and in the current directory.
<Sysname> dir /all
Directory of flash:/
0 -rwh 3080 Apr 26 2008 16:41:43 private-data.txt
1 -rw- 2416 Apr 26 2008 13:45:36 config.cfg
2 -rw- 8036197 May 14 2008 10:13:18 main.bin
3 -rw- 2386 Apr 26 2008 13:30:30 back.cfg
4 drw- - May 08 2008 09:49:25 test
5 -rwh 716 Apr 24 2007 16:17:30 hostkey
6 -rwh 572 Apr 24 2007 16:17:44 serverkey
7 -rw- 2386 May 08 2008 11:14:20 [a.cfg]
8 -rw- 3608 Dec 03 2007 17:29:30 [b.cfg]
97920 KB total (6730 KB free)
//The output shows that the current directory is flash:, and there are two files a.cfg and b.cfg in the recycle bin.
· Delete file b.cfg in the current directory and in the recycle bin.
<Sysname> reset recycle-bin
Clear flash:/~/a.cfg ?[Y/N]:n
Clear flash:/~/b.cfg ?[Y/N]:y
Clearing files from flash may take a long time. Please wait...
......
%Cleared file flash:/~/b.cfg...
· In directory flash:, check whether the file b.cfg in the recycle bin is deleted.
<Sysname> dir /all
Directory of flash:/
0 -rwh 3080 Apr 26 2008 16:41:43 private-data.txt
1 -rw- 2416 Apr 26 2008 13:45:36 config.cfg
2 -rw- 8036197 May 14 2008 10:13:18 main.bin
3 -rw- 2386 Apr 26 2008 13:30:30 back.cfg
4 drw- - May 08 2008 09:49:25 test
5 -rwh 716 Apr 24 2007 16:17:30 hostkey
6 -rwh 572 Apr 24 2007 16:17:44 serverkey
7 -rw- 2386 May 08 2008 11:14:20 [a.cfg]
97920 KB total (6734 KB free)
// The output shows that file flash:/b.cfg is deleted permanently.
# Delete file aa.cfg in the subdirectory test and in the recycle bin.
· Enter the subdirectory
<Sysname> cd test/
· Check all the files in the subfolder test.
<Sysname> dir /all
Directory of flash:/test
0 -rw- 2161 Apr 26 2000 21:22:35 [aa.cfg]
14605 KB total (6734 KB free)
// The output shows that only one file exists in the folder, and the file has been moved to the recycle bin.
· Permanently delete file test/aa.cfg.
<Sysname> reset recycle-bin
Clear flash:/test/~/aa.cfg ?[Y/N]:y
Clearing files from flash may take a long time. Please wait...
..
%Cleared file flash:/test/~/aa.cfg...
rmdir
Syntax
rmdir directory
View
User view
Default level
3: Manage level
Parameters
directory: Name of the folder.
Description
Use the rmdir command to remove a folder.
The folder must be an empty one. If not, you need to delete all files and subfolders under it with the delete command.
After you execute the rmdir command successfully, the files in the recycle bin in the folder will be automatically deleted.
Examples
# Remove folder mydir.
<Sysname> rmdir mydir
Rmdir flash:/mydir?[Y/N]:y
%Removed directory flash:/mydir.
undelete
Syntax
undelete file-url
View
User view
Default level
3: Manage level
Parameters
file-url: Name of the file to be restored.
Description
Use the undelete command to restore a file from the recycle bin.
If another file with the same name exists in the same path, the system prompts you whether to overwrite the original file.
Examples
# Restore file a.cfg in directory flash: from the recycle bin.
<Sysname> undelete a.cfg
Undelete flash:/a.cfg?[Y/N]:y
.....
%Undeleted file flash:/a.cfg.
# Restore file b.cfg in directory flash:/test from the recycle bin.
<Sysname> undelete flash:/test/b.cfg
Undelete flash:/test/b.cfg?[Y/N]:y
.......
%Undeleted file flash:/test/b.cfg.
Or, you can use the following steps to restore file flash:/test/b.cfg.
<Sysname> cd test
<Sysname> undelete b.cfg
Undelete flash:/test/b.cfg?[Y/N]:y
.....
%Undeleted file flash:/test/b.cfg.