Chapter 1 File System Management Commands
You can provide the
directory argument in the following two ways in this chapter.
l
In the form of [drive] [path]. In this case, the
argument can be a string containing 1 to 64 characters.
l
By specifying the name of a storage device, such
as flash:/ and cf:/.
You can provide the
file-url argument in the following two ways in this chapter.
l
In the form of [drive] [path] [file name]. In
this case, the argument can be a string containing 1 to 64 characters.
l
By specifying the name of a storage device, such
as flash:/ and cf:/.
1.1.1 cd
Syntax
cd directory
View
User view
Parameter
directory:
Target directory.
Description
Use the cd command to change the
current directory or switch to a specified storage device.
Before switching to
a storage device by using this command, make sure the storage device is
correctly installed.
Example
# Change the current directory to the one
named “test” in the flash.
<H3C> pwd
flash:
<H3C> cd test
<H3C> pwd
flash:/test
# Enter the root directory of the CF card.
<H3C> cd cf:
<H3C> pwd
cf:
1.1.2 copy
Syntax
copy fileurl-source
fileurl-dest
View
User view
Parameter
fileurl-source:
Path name and file name of the source file.
fileurl-dest:
Path name and file name of the destination file.
Description
Use the copy command to copy a file
to a specified path with specified name.
You can use this command to copy a file in
the current directory to another directory or copy a file in a directory to the
current directory. Make sure the path and the file identified by the fileurl-source
argument exist when executing this command.
If the fileurl-dest argument
identifies an existing file, the system prompts you for the confirmation to
overwrite the existing file.
Example
# Display the information about the files
in the current directory.
<H3C> dir
Directory of flash:/
0 -rw- 4 Mar 09 2006
13:59:19 snmpboots
1 -rw- 16215134 Apr 04 2006
16:36:20 S7500.app
2 -rw- 553 Jan 21 2006
17:05:55 diaginfo.txt
3 -rw- 3906 Apr 04 2006
17:23:54 config.cfg
4 -rw- 11779 Apr 05 2006
10:19:48 test.txt
31877 KB total (15973 KB free)
# Copy the file test.txt, with the
destination file name being test2.bak.
<H3C> copy test.txt test2.bak
Copy flash:/test.txt to
flash:/test2.bak?[Y/N]:y
.....
%Copy file flash:/test.txt to
flash:/test2.bak...Done.
# Display the information about the files
in the current directory again.
<H3C> dir
Directory of flash:/
0 -rw- 4 Mar 09
2006 13:59:19 snmpboots
1 -rw- 16215134 Apr 04 2006
16:36:20 S7500.app
2 -rw- 553 Jan 21 2006
17:05:55 diaginfo.txt
3 -rw- 3906 Apr 04 2006
17:23:54 config.cfg
4 -rw- 11779 Apr 05 2006
10:19:48 test.txt
5 -rw- 11779 Apr 05 2006
10:23:03 test2.bak
31877 KB total (15961 KB free)
1.1.3 delete
Syntax
delete [ /unreserved
] file-url
View
User view
Parameter
/unreserved:
Deletes a file completely.
file-url:
Path name and file name of the file to be deleted.
Description
Use the delete command to delete a
file on a switch.
You can use the * character in this command
as a wildcard.
If you execute the delete command
with the /unreserved keyword specified, the specified file is completely
deleted. That is, the file cannot be restored. Otherwise, the specified file is
moved to the recycle bin and can be restored using the undelete command.
To delete the files in the recycle bin, use
the reset recycle-bin command.
Caution:
l
The dir command does not display the
information about the files in the recycle bin.
l
To display the information about the files in
the recycle bin, use the dir /all command.
l
For files with the same name, the recycle bin
can only hold the latest deleted one.
Example
# Delete the file test.txt, assuming that
it resides in the root directory of the flash.
<H3C> delete flash:/test.txt
Delete flash:/test.txt?[Y/N]:y
...
%Deleted file flash:/test.txt.
1.1.4 dir
Syntax
dir [ /all
] [ file-url ]
View
User view
Parameter
/all:
Displays the information about all the files, including those in the recycle
bin.
file-ur:
Path and the name of a file whose information is to be displayed. You can use
the * character as a wildcard in this argument. For example, the dir *.txt
command displays the information about all the files with the extension of txt
in the current directory.
Description
Use the dir command to display the
information about the files or directories in the storage devices on a switch.
You can use the * character as a wildcard.
Example
# Display the information about the file
test2.bak.
<H3C> dir test2.bak
Directory of flash:/
0 -rw- 11779 Apr 05 2006
10:23:03 test2.bak
31877 KB total (15961 KB free)
# Display the information about all the
files (including the files in the recycle bin) in directory flash:/hello/.
<H3C> dir /all flash:/hello/
Directory of flash:/hello/
0 -rw- 11779 Apr 05 2006
10:54:16 tt.txt
1 -rw- 11779 Apr 05 2006
10:55:10 [tt2.txt]
31877 KB total (15935 KB free)
In the output
information of the dir /all command, the names of the files in the
recycle bin are embraced in brackets.
1.1.5 execute
Syntax
execute
file-url
View
System view
Parameter
file-url:
Path and the name of the batch file to be executed. A batch file has an
extension of .bat.
Description
Use the execute command to
execute a batch file.
As this command executes the commands in a
batch file in sequence, you can add the most frequently executed commands to a
batch file to simplify your daily maintain task.
Note that
l
As the execute command stops executing a
batch file and quit without undoing the operations already performed when
encountering a invisible character in the batch file, do not insert invisible
characters in a batch file.
l
A syntax error in a batch file results in error
messages.
l
This command cannot be executed recursively.
Example
# Execute the batch file test.bat (assuming
that the file resides in the directory flash:/).
<H3C> system-view
System View: return to User View with
Ctrl+Z.
[H3C] execute test.bat
1.1.6 file
prompt
Syntax
file prompt {
alert | quiet }
View
System view
Parameter
alert:
Prompts for confirmation before performing file-related operations that have
potential risks.
quiet:
Disables prompts for file-related operations.
Description
Use the file prompt command to set
the prompt mode for file-related operations.
By default, a switch prompts for
confirmation before performing file-related operations that have potential
risks.
If you set the prompt mode to quiet for the
file-related operations, the switch does not prompt for confirmation before
performing file-related operations. In this case, the system is more likely to
operate improperly if irretrievable file-related operations are performed.
Example
# Set the prompt mode to quiet for
file-related operations.
<H3C> system-view
System View: return to User View with
Ctrl+Z.
[H3C] file prompt quiet
1.1.7 fixdisk
Syntax
fixdisk device
View
User view
Parameter
device:
Device name.
Description
Use the fixdisk command to restore
the space on a storage device.
For unavailable memory spaces, you can use
this command to restore them.
Example
# Restore the memory space on the flash.
<H3C> fixdisk flash:
Fixdisk flash: may take some time to
complete.
%Fixdisk flash: completed.
Syntax
format device
View
User view
Parameter
device: Device
name.
Description
Use the format command to format a
storage device.
Note that all the data on a storage device
get lost after the storage device is formatted. The operation is irretrievable.
Moreover, the configuration files get lost if you format the flash.
Example
# Format the flash.
<H3C> format flash:
All data on Flash will be lost ,
proceed with format ? [Y/N] y
% Now begin to format flash, please
wait for a while...
Format winc: completed
1.1.9 mkdir
Syntax
mkdir directory
View
User view
Parameter
directory:
Name of the directory to be created.
Description
Use the mkdir command to create a
directory in the current directory.
When creating a directory using this
command, make sure the directory name specified is not the same as that of any
directory/file in the directory.
Example
# Create a directory in the current
directory, with the name being “dd”.
<H3C> mkdir dd
...
% Created dir flash:/dd
Syntax
more file-url
View
User view
Parameter
file-url:
Path and name of a file.
Description
Use the more command to display the
content of a file.
Currently, the content of a file can only
be displayed in text.
Example
# Display the content of the file test.txt.
<H3C> more test.txt
The file is for test only.
1.1.11 move
Syntax
move fileurl-source
fileurl-dest
View
User view
Parameter
fileurl-source:
Path and file name of the source file.
fileurl-dest:
Path and file name of the target file.
Description
Use the move command to move a file
to a specified directory. You can also assign a new name for the file.
If the target file name specified is the
same as that of an existing file in the destination directory, the system
prompts you for the confirmation to overwrite the existing file.
Example
# Display the information about the files
in flash:/ and flash:/hello.
<H3C> dir
Directory of flash:/
0 -rw- 4 Mar 09 2006
13:59:19 snmpboots
1 -rw- 16215134 Apr 04 2006
16:36:20 S7500.app
2 -rw- 553 Jan 21 2006
17:05:55 diaginfo.txt
3 -rw- 3906 Apr 04 2006
17:23:54 config.cfg
4 drw- - Apr 05 2006
10:53:23 hello
5 drw- - Apr 10 2005
19:07:59 dd
6 -rw- 11779 Apr 05 2006
10:23:03 test2.bak
7 drw- - Jan 25 2005
11:08:59 backup
31877 KB total (15935 KB free)
<H3C> dir flash:/hello/
Directory of flash:/hello/
0 -rw- 11779 Apr 05 2006
10:54:16 tt.txt
1 -rw- 11779 Apr 05 2006
11:12:52 tt2.txt
31877 KB total (15935 KB free)
# Move the file
tt.txt from the directory flash:/hello to the directory flash:/.
<H3C>move flash:/hello/tt.txt
flash:/tt.txt
Move flash:/hello/tt.txt to
flash:/tt.txt?[Y/N]:y
...
%Moved file flash:/hello/tt.txt to
flash:/tt.txt.
# Display the
information about the files in flash:/ and flash:/hello again.
<H3C> dir
Directory of flash:/
0 -rw- 4 Mar 09 2006
13:59:19 snmpboots
1 -rw- 16215134 Apr 04 2006
16:36:20 S7500.app
2 -rw- 553 Jan 21 2006
17:05:55 diaginfo.txt
3 -rw- 3906 Apr 04 2006
17:23:54 config.cfg
4 drw- - Apr 05 2006
10:53:23 hello
5 drw- - Apr 10 2005
19:07:59 dd
6 -rw- 11779 Apr 05 2006
10:23:03 test2.bak
7 -rw- 11779 Apr 05 2006
11:30:13 tt.txt
8 drw- - Jan 25 2005
11:08:59 backup
31877 KB total (15935 KB free)
<H3C> dir flash:/hello/
Directory of flash:/hello/
0 -rw- 11779 Apr 05 2006
11:12:52 tt2.txt
31877 KB total (15934 KB free)
Syntax
pwd
View
User view
Parameter
None
Description
Use the pwd command to display the
current path.
Example
# Display the current path.
<H3C> pwd
flash:
Syntax
rename fileurl-source
fileurl-dest
View
User view
Parameter
fileurl-source:
File name of the file to be renamed.
fileurl-dest:
Target file name.
Description
Use the rename command to rename a
file.
If the target file name or directory name
is the same as that of any existing file or name, you will fail to rename the
file.
Example
# Display the information about the files
in the current directory.
<H3C> dir
Directory of flash:/
0 -rw- 4 Mar 09 2006
13:59:19 snmpboots
1 -rw-
16215134 Apr 04 2006 16:36:20 S7500.app
2 -rw- 553 Jan 21 2006
17:05:55 diaginfo.txt
3 -rw- 3906 Apr 04 2006
17:23:54 config.cfg
4
drw- - Apr 05 2006 10:53:23 hello
5 drw- - Apr 10 2005
19:07:59 dd
6 -rw- 11779 Apr 05 2006
10:23:03 test2.bak
7 -rw- 11779 Apr 05 2006
11:30:13 tt.txt
8 drw- - Jan 25 2005
11:08:59 backup
31877 KB total (15935 KB free)
# Rename the file
tt.txt as tt.bak.
<H3C> rename tt.txt tt.bak
Rename
flash:/tt.txt to flash:/tt.bak?[Y/N]:y
...
%Renamed
file flash:/tt.txt to flash:/tt.bak.
# Display the information about the files
in the current directory again.
<H3C>dir
Directory
of flash:/
0
-rw- 4 Mar 09 2006 13:59:19 snmpboots
1 -rw- 16215134 Apr 04 2006
16:36:20 S7500.app
2
-rw- 553 Jan 21 2006 17:05:55 diaginfo.txt
3 -rw-
3906 Apr 04 2006 17:23:54 config.cfg
4
drw- - Apr 05 2006 10:53:23 hello
5 drw- - Apr 10 2005
19:07:59 dd
6
-rw- 11779 Apr 05 2006 10:23:03 test2.bak
7
-rw- 11779 Apr 05 2006 11:36:06 tt.bak
8
drw- - Jan 25 2005 11:08:59 backup
31877
KB total (15934 KB free)
1.1.14 reset recycle-bin
Syntax
reset recycle-bin
[ file-url ] [ /force ]
View
User view
Parameter
/force: Does
not prompt for the confirmation before deleting all the files in the recycle
bin.
file-url:
Path and the file name of the file to be deleted.
Description
Use the reset recycle-bin command to
clear a specified file or all the files in the recycle bin.
You can use the * as a wild card in the file-url
argument.
The files deleted using the delete
command are actually moved to the recycle bin if you do not specify the /unreserved
keyword. To delete the files in the recycle bin completely, use the reset
recycle-bin command.
Example
# Delete the file test.txt in the recycle
bin.
<H3C> reset recycle-bin
flash:/test.txt
Clear flash:/test.txt ?[Y/N]:y
Clear file from flash will take long
time if needed...
...
%Cleared file flash:/test.txt.
1.1.15 rmdir
Syntax
rmdir directory
View
User view
Parameter
directory:
Directory.
Description
Use the rmdir command to delete a
directory.
As only empty directories can be deleted,
you need to delete all the files in a directory first if you want to delete the
directory.
After you delete a
directory using the rmdir command, the files in the recycle bin but
originally residing in the directory are deleted automatically.
Example
# Delete the directory named hello.
<H3C> rmdir hello
The files in the recycle-bin under
this directory will be deleted permanently, Remove flash:/hello?[Y/N]:y
...
%Removed directory flash:/hello.
Syntax
umount cf:
View
User view
Parameter
None
Description
Use the umount
cf: command to disable the CF card. After you execute this command, you
need to re-install the CF card to use it again.
This command can be
executed successfully only when the CF card is correctly installed.
Example
# Disable the CF card.
<H3C>umount cf:
%Umount cf: succeed.Current directory
is changed to flash:.
# Verify the above operation by displaying
the information about the CF card.
<H3C> dir cf:
% Wrong device "cf:"
1.1.17 undelete
Syntax
undelete file-url
View
User view
Parameter
file-url:
Path and the file name of a file in the recycle bin.
Description
Use the undelete command to restore
a deleted file in the recycle bin.
If the name of the file to be restored is
the same as that of an existing file in the same directory, the system prompts
you for the confirmation to overwrite the latter.
Example
# Restore
the deleted file with its path and file name being flash:/hello/tt2.txt.
<H3C> undelete
flash:/hello/tt2.txt
Undelete flash:/hello/tt2.txt?[Y/N]:y
...
%Undeleted file flash:/hello/tt2.txt.