H3C S3100-52P Command Manual-Release 1602(V1.01)

HomeSupportSwitchesH3C S3100 Switch SeriesReference GuidesCommand ReferencesH3C S3100-52P Command Manual-Release 1602(V1.01)
30-File System Management Command
Title Size Download
30-File System Management Command 84.86 KB

Chapter 1  File System Management Configuration Commands

 

&  Note:

S3100-52P Ethernet switches allow you to input a file path and file name in one of the following ways:

l      In universal resource locator (URL) format and starting with “unit1>flash:/”. or “flash:/” This method is used to specify a file in the current Flash memory. For example, the URL of a file named text.txt in the root directory of the switch is unit1>flash:/text.txt or flash:/text.txt.

l      Entering the path name or file name directly. This method can be used to specify a path or a file in the current work directory. For example, to access file text.txt in the current directory, you can directly input the file name text.txt as the file URL.

 

1.1  File System Configuration Commands

 

&  Note:

Note to limit the lengths of device name, directory name, file path and file name within the following ranges regulated for the switch.

l      A directory name should be no more than 91 characters.

l      A file name plus its local path name should be no more than 127 characters.

l      A device name should be no more than 14 characters.

l      A file name plus its complete path name should be no more than 142 characters.

 

1.1.1  cd

Syntax

cd directory

View

User view

Parameter

directory: Target directory.

Description

Use the cd command to enter a specified directory on the Ethernet switch.

The default directory when a user logs onto the switch is the root directory of Flash memory.

Example

# Enter the directory named test from the root directory.

<Sysname> cd test

# Return to the upper directory. Note that keyword cd is followed by a space.

<Sysname> cd ..

After modifying the working directory using the cd command, you can use the pwd command to display the current working directory.

1.1.2  copy

Syntax

copy fileurl-source fileurl-dest

View

User view

Parameter

fileurl-source: Name of the source file.

fileurl-dest: Name of the target file.

Description

Use the copy command to copy a file.

If the fileurl-dest argument identifies an existing file, the existing file will be overwritten after the command is executed successfully.

If the path, rather than the name of the target file is specified, the source file name is used as the target file name by default.

Example

# Copy file config.cfg from the root directory to directory test, and save the file using name 1.cfg.

<Sysname> copy flash:/config.cfg flash:/test/1.cfg

Copy unit1>flash:/config.cfg to unit1>flash:/test/1.cfg?[Y/N]:y

...

%Copy file unit1>flash:/config.cfg to unit1>flash:/test/1.cfg...Done.

# Copy file config.cfg from the root directory to directory test, and save the file using the original file name.

<Sysname> copy flash:/config.cfg flash:/test

Copy unit1>flash:/config.cfg to unit1>flash:/test/config.cfg?[Y/N]:y

...

%Copy file unit1>flash:/config.cfg to unit1>flash:/test/config.cfg...Done.

1.1.3  delete

Syntax

delete [ /unreserved ] file-url

delete { running-files | standby-files } [ /unreserved ]

View

User view

Parameter

/unreserved: Specifies to delete a file completely.

file-url: Path name or file name of a file in the Flash memory. You can use the * character in this argument as a wildcard. For example, the delete *.txt command deletes all the files with txt as their extensions.

running-files: Specifies to delete all the files with the main attribute.

standby-files: Specifies to delete all the files with the backup attribute.

Description

Use the delete command to delete a specified file from the Flash memory on a switch.

If you execute the delete command with the /unreserved keyword specified, the specified file is permanently deleted. That is, the file cannot be restored. If you execute the delete command without the /unreserved keyword, the specified file is removed to the recycle bin, and you can use the undelete command to restore it.

You can delete files based on file attribute.

l           If you execute the delete running-files command, all the files with the main attribute will be deleted.

l           If you execute the delete standby-files command, all the files with the backup attribute will be deleted.

For a file that has both the main and backup attributes:

l           The delete running-files command only deletes its main attribute instead of the file itself.

l           The delete standby-files command only deletes its backup attribute instead of the file itself.

When you use the delete running-files or delete standby-files command, you will be prompted to confirm whether to delete all files with the main/backup attribute. If you choose yes, the corresponding files are deleted. If you choose no, the system will further to prompt you to confirm the following items orderly:

1)         Delete the image files with the main/backup attribute?

2)         Delete the configuration files with the main/backup attribute?

3)         Delete the Web files with the main/backup attribute?

The corresponding messages are displayed as follows:

Delete the running image file? [Y/N]:

Delete the running config file? [Y/N]:

Delete the running web file? [Y/N]:

 

Delete the backup image file? [Y/N]:

Delete the backup config file? [Y/N]:

Delete the backup web file? [Y/N]:

The corresponding files will be deleted after you choose yes.

 

  Caution:

For deleted files whose names are the same, only the latest deleted file is stored in the recycle bin and can be restored.

 

Example

# Delete the file test/test.txt.

<Sysname> delete test/test.txt

Delete unit1>flash:/test/test.txt?[Y/N]:y

.

%Delete file unit1>flash:/test/test.txt...Done.

# Delete the configuration files with the backup attribute in the Flash.

<Sysname> delete standby-files

Delete all the backup files? [Y/N]:n

Delete the backup image file? [Y/N]:n

Delete the backup config file? [Y/N]:y

Delete the backup web file? [Y/N]:n

Start deleting ...

Deleting ... done

1.1.4  dir

Syntax

dir [ /all ] [ file-url ]

View

User view

Parameter

/all: Specifies to display the information about all the files, including those stored in the recycle bin.

file-ur: Path name or the name of a file in the Flash memory. You can use the * character as a wildcard. 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 specified files or directories in the Flash memory on a switch.

l           If executed with the /all keyword, the command will display information about all files, including the files in the recycle bin. If executed without the /all keyword, the command will not display the files in the recycle bin.

l           If executed with the file-url argument, the command will display information about files and folders in the specified directory. If executed without the file-url argument, the command will display information about files and folders in the current working directory.

In the output information, files with the main, backup or main/backup attribute are tagged with special characters:

l           main: (*)

l           backup: (b)

l           main/backup: (*b)

 

&  Note:

In the output information of the dir /all command, deleted files (that is, those in the recycle bin) are embraced in brackets. The displayed directory of a deleted file is the directory to which the file belongs before it is deleted.

 

Example

# Display the information about all the files (including the files in the recycle bin) in the root directory of the file system.

<Sysname> dir /all

Directory of unit1>flash:/

 

   1 (*)   -rw-   3579326  Mar 28 2007 10:51:22   switch.bin

   2 (*)   -rw-      1235  Apr 03 2000 16:04:52   basic.cfg

   3       -rw-    140709  Apr 04 2000 21:31:08   cmdtree_b01d015.txt

   4       -rw-      1235  Apr 04 2000 23:03:08   test.txt

   5       drw-         -  Apr 04 2000 23:04:21   test

   6       -rw-      1235  Apr 04 2000 23:05:41   [1.cfg]

 

7239 KB total (3590 KB free)

 

(*) -with main attribute   (b) -with backup attribute

(*b) -with both main and backup attribute

# Display the information about all the files whose names begin with the character t (including those in the recycle bin) in the local directory unit1>flash:/test/.

<Sysname> dir /all test/t*

Directory of unit1>flash:/test/

 

   1       -rw-      1235  Apr 04 2000 23:08:28   test.txt

 

7239 KB total (3590 KB free)

 

(*) -with main attribute   (b) -with backup attribute

(*b) -with both main and backup attribute

1.1.5  execute

Syntax

execute filename

View

System view

Parameter

filename: Batch file, with the extension .bat.

Description

Use the execute command to execute the specified batch file. Executing a batch file is to execute a set of commands in the batch file one by one.

Note that:

l           A batch file cannot contain any invisible character. If any invisible character is found, the system will abort the execution of the batch file, that is, the remaining commands in the batch file will not be executed, but the executed operations will not be cancelled.

l           Not every command in a batch file is sure to be executed. For example, if a certain command is not correctly configured, the system omits this command and goes to the next one.

l           Each configuration command in a batch file must be a standard configuration command, meaning that the configuration information can be displayed with the display current-configuration command after this command is configured successfully; otherwise, this command may not be executed correctly.

Example

# Execute the batch file named test.bat under the directory flash:/.

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] execute test.bat

<Sysname>

....

%Created dir unit1>flash:/test3.

1.1.6  file prompt

Syntax

file prompt { alert | quiet }

View

System view

Parameter

alert: Specifies to prompt for confirmation before performing file-related operations that have potential risks.

quiet: Specifies to disable prompts for file-related operations.

Description

Use the file prompt command to configure the prompt mode for file-related operations.

By default, alert mode is used, by which a switch prompts for confirmation before performing file-related operations that have potential risks.

If you set the prompt mode of the file-related operations to quiet, the switch does not prompt for confirmation before performing file-related operations. In this case, the system is more likely to be damaged due to some maloperations. For example:

l           If the prompt mode is set to alert, the following messages will be displayed when you delete a file:

<Sysname> delete flash:/te.txt

Delete unit1>flash:/te.txt?[Y/N]:y

......

%Delete file unit1>flash:/te.txt...Done.

The system waits for you to confirm for 30 seconds. If you do not input any confirmation in 30 seconds, the system cancels this file operation, as shown in the following:

<Sysname> delete flash:/tt.txt

Delete unit1>flash:/tt.txt?[Y/N]:

<Sysname>

l           If the prompt mode is set to quiet, the following messages will be displayed when you delete a file:

<Sysname> delete flash:/te.txt

....

%Delete file unit1>flash:/te.txt...Done.    

Example

# Set the prompt mode to quiet for file-related operations.

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] file prompt quiet

1.1.7  fixdisk

Syntax

fixdisk device

View

User view

Parameter

device: Name of a device which must be “unit1>flash:” or “flash:” for S3100-52P Ethernet switches.

Description

Use the fixdisk command to restore space on the Flash memory.

In case that space on the Flash memory may become unavailable for reasons such as abnormal operations, you can run this command to restore the space.

Example

# Restore space on the Flash memory.

<Sysname> fixdisk unit1>flash:

Fixdisk flash: may take some time to complete.

%Fixdisk unit1>flash: completed.

1.1.8  format

Syntax

format device

View

User view

Parameter

device: Name of a device which must be “unit1>flash:” or “flash:” for S3100-52P Ethernet switches.

Description

Use the format command to format the Flash memory.

 

  Caution:

The format operation clears all the files on the Flash memory, and the operation is irretrievable.

 

Example

# Format the Flash memory.

<Sysname>format unit1>flash:

All data on unit1>flash: will be lost , proceed with format ? [Y/N]:y

..............................

%Format unit1>flash: completed.

1.1.9  mkdir

Syntax

mkdir directory

View

User view

Parameter

directory: Name of a directory.

Description

Use the mkdir command to create a subdirectory in the specified directory of a Flash memory.

Note that:

l           The name of the subdirectory to be created must be unique under the specified directory. Otherwise, you will fail to create the subdirectory under the directory.

l           To use this command to create a subdirectory, the specified directory must exist. For instance, to create subdirectory flash:/test/mytest, the test directory must exist. Otherwise, you will fail to create the subdirectory.

Example

# Create a directory in the current directory, with the name being test.

<Sysname> mkdir test

....

%Created dir unit1>flash:/test.

# Create subdirectory mytest in the directory test.

<Sysname> mkdir test/mytest

..

%Created dir unit1>flash:/test/mytest.

1.1.10  more

Syntax

more file-url

View

User view

Parameter

file-url: Path name or file name of a file in the Flash memory.

Description

Use the more command to display the contents of a specified file.

Currently, the file system only supports to display the contents of text files.

Example

# Display the content of the file named test.txt.

<Sysname> more test.txt

AppWizard has created this test application for you.

This file contains a summary of what you will find in each of the files that make up your test application.

Test.dsp

This file (the project file) contains information at the project level and is used to build a single project or subproject. Other users can share the project (.dsp) file, but they should export the makefiles locally.

# Display the content of the file testcfg.cfg.

<Sysname> more testcfg.cfg

 

#

 sysname Sysname

#

 configure-user count 5

#

vlan 2

#

return

<Sysname>

1.1.11  move

Syntax

move fileurl-source fileurl-dest

View

User view

Parameter

fileurl-source: Name of the source file.

fileurl-dest: Name of the target file.

Description

Use the move command to move a file to a specified directory.

If the target file name is the same as an existing file, the existing file will be overwritten after the command is executed successfully.

If the path, rather than the name of the target file is specified, the source file name is used as the target file name by default.

Example

# Move the file named 1.txt from unit1>flash:/ to unit1>flash:/a/, with the name unchanged.

<Sysname>move unit1>flash:/1.txt unit1>flash:/a/

Move unit1>flash:/1.txt to unit1>flash:/a/1.txt?[Y/N]:y

.

%Moved file unit1>flash:/1.txt to unit1>flash:/a/1.txt.

# Move the file unit1>flash:/22.txt to unit1>flash:/test/, and overwrite the file in the directory unit1>flash:/test.

<Sysname>move 22.txt unit1>flash:/test

Move unit1>flash:/22.txt to unit1>flash:/test/22.txt?[Y/N]:y

The file unit1>flash:/test/22.txt exists. Overwrite it?[Y/N]:y

The file will be permanently deleted from flash, please wait.

....

%Moved file unit1>flash:/22.txt to unit1>flash:/test/22.txt.

1.1.12  pwd

Syntax

pwd

View

User view

Parameter

None

Description

Use the pwd command to display the current working path of the login user.

Example

# Display the current working path.

<Sysname> pwd

unit1>flash:

1.1.13  rename

Syntax

rename fileurl-source fileurl-dest

View

User view

Parameter

fileurl-source: Original path name or file name of a file in the Flash memory.

fileurl-dest: Target path name or file name.

Description

Use the rename command to rename a file or a directory.

If the target file name or directory name is the same with any existing file name or directory name, you will fail to perform the rename operation.

Example

# Rename the file named config.txt to config.bak.

<Sysname>rename config.txt config.bak

Rename unit1>flash:/config.txt to unit1>flash:/config.bak?[Y/N]:y

.

%Renamed file unit1>flash:/config.txt to unit1>flash:/config.bak.

1.1.14  reset recycle-bin

Syntax

reset recycle-bin [ file-url ] [ /force ]

View

User view

Parameter

file-url: Path name or file name of a file in the Flash memory. This argument supports the wildcard “*”. For example, *.txt means all the files with an extension of txt.

/force: Specifies not to prompt for confirmation before deleting files.

Description

Use the reset recycle-bin command to permanently delete the files in the recycle bin in the current directory.

Use the reset recycle-bin file-url command to permanently delete the files in the recycle bin in the specified directory.

By default, the file operation reminding mode is alert, meaning that when you clear the files in the recycle bin on the local unit, the system will ask for your confirmation for each file you want to delete. However, if you specify the /force keyword in the command, the system will not ask for your confirmation.

The files deleted by the delete command without the /unreserved keyword are moved to the recycle bin. To delete them permanently, you can use the reset recycle-bin command.

Example

# There are three files flash:/a.cfg, flash:/b.cfg, and flash:/test/c.cfg in the recycle bin. Permanently delete file flash:/a.cfg and flash:/b.cfg.

l           Display all the files in the recycle bin in directory flash:.

<Sysname> dir /all

Directory of flash:/

 

   0     -rwh      3080  Apr 26 2000 16:41:43   private-data.txt

   1     -rw-      2416  Apr 26 2000 13:45:36   config.cfg

   2     -rw-   4036197  May 14 2000 10:13:18   main.bin

   3     -rw-      2386  Apr 26 2000 13:30:30   back.cfg

   4     drw-         -  May 08 2000 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 2000 11:14:20   [a.cfg]

   8     -rw-      3608  Dec 03 2007 17:29:30   [b.cfg]

 

7239 KB total (1930 KB free)

//The above information indicates that in directory flash:, there are two files a.cfg and b.cfg in the recycle bin.

l           Delete the files in directory flash: that are already in the recycle bin.

<Sysname> reset recycle-bin

Clear flash:/~/a.cfg ?[Y/N]:y

Clearing files from flash may take a long time. Please wait...

....

%Cleared file flash:/~/a.cfg.

Clear flash:/~/b.cfg ?[Y/N]:y

Clearing files from flash may take a long time. Please wait...

......

%Cleared file flash:/~/b.cfg...

l           In directory flash:, check whether all the files in the recycle bin are deleted.

<Sysname> dir /all

Directory of flash:/

 

   0     -rwh      3080  Apr 26 2000 16:41:43   private-data.txt

   1     -rw-      2416  Apr 26 2000 13:45:36   config.cfg

   2     -rw-   4036197  May 14 2000 10:13:18   main.bin

   3     -rw-      2386  Apr 26 2000 13:30:30   back.cfg

   4     drw-         -  May 08 2000 09:49:25   test

   5     -rwh       716  Apr 24 2007 16:17:30   hostkey

   6     -rwh       572  Apr 24 2007 16:17:44   serverkey

 

7239 KB total (1934 KB free)

// The above information indicates that file flash:/a.cfg and flash:/b.cfg are deleted permanently.

l           In directory flash:/test, see whether the file in the recycle bin is deleted or not.

<Sysname> cd test

<Sysname> dir /all

Directory of flash:/test/

 

   0     drw-         -  Dec 03 2007 18:19:09   subtest

   1     -rw-      2386  Dec 03 2007 18:43:41   [c.cfg]

 

7239 KB total (1934 KB free)

// The above information indicates that file flash:/test/c.cfg in directory flash:/test is not deleted and is still in the recycle bin.

1.1.15  rmdir

Syntax

rmdir directory

View

User view

Parameter

directory: Name of a directory.

Description

Use the rmdir command to delete a directory.

As only empty directories can be deleted, you need to clear a directory before deleting it.

Example

# Delete the directory named dd.

<Sysname> rmdir dd

Rmdir unit1>flash:/dd?[Y/N]:y

....

%Removed directory unit1>flash:/dd.

1.1.16  undelete

Syntax

undelete file-url

View

User view

Parameter

file-url: Path name or file name of a file in the Flash memory.

Description

Use the undelete command to restore a deleted file from the recycle bin.

If the name of the file to be restored is the same as that of an existing file, the existing file will be overwritten after the command is executed successfully.

Example

# Restore the deleted file named sample.bak.

<Sysname> undelete sample.bak

Undelete unit1>flash:/sample.bak ?[Y/N]:y

% Undeleted file unit1>flash:/sample.bak.

1.2  File Attribute Configuration Commands

1.2.1  boot attribute-switch

Syntax

boot attribute-switch { all | app | configuration | web }

View

User view

Parameter

all: Specifies all the files, including app files, configuration files and Web files.

app: Specifies app files.

configuration: Specifies configuration files.

web: Specifies Web files.

Description

Use the boot attribute-switch command to switch between the main and backup attribute for all the files or a specified type of files. That is, change a file with the main attribute to one with the backup attribute, or vice versa.

Example

# Switch the attributes of all the files.

<Sysname> boot attribute-switch all

 The boot, web and configuration file's backup-attribute and main-attribute will exchange.                                                                  

 Are you sure? [Y/N] y                                                         

 The boot, web and configuration file's backup-attribute and main-attribute exchanged successfully on unit 1!                                              

1.2.2  boot boot-loader

Syntax

boot boot-loader file-url

View

User view

Parameter

file-url: Path or the name of the app file in the Flash memory, a string comprising 1 to 64 characters.

Description

Use the boot boot-loader command to configure an app file of the device to be with the main attribute. The app file specified by this command becomes the main startup file when the device starts up next time.

Example

# Configure the file named boot.bin to be the main startup file of the device.

<Sysname> boot boot-loader boot.bin

 The specified file will be booted next time on unit 1!

1.2.3  boot boot-loader backup-attribute

Syntax

boot boot-loader backup-attribute file-url

View

User view

Parameter

file-url: Path or the name of the app file in the Flash memory, a string comprising 1 to 64 characters.

Description

Use the boot boot-loader backup-attribute command to configure an app file of the device to be with the backup attribute. The app file specified by this command becomes the backup startup file when the device starts up next time. When the main startup file is unavailable, the backup startup file is used to start the switch.

Example

# Configure the file named backup.bin to be the backup startup file of the device.

<Sysname> boot boot-loader backup-attribute backup.bin

 Set boot file backup-attribute successfully on unit 1!

1.2.4  boot web-package

Syntax

boot web-package webfile { backup | main }

View

User view

Parameter

webfile: Name of a Web file, a string comprising 5 to 127 characters (including the extension .web).

main: Specifies the file to be with the main attribute.

backup: Specifies the file to be with the backup attribute.

Description

Use the boot web-package command to configure a Web file in the device to be with the main or backup attribute.

 

  Caution:

l      The configuration of the main or backup attribute for a Web file takes effect immediately without restarting the device.

l      After you upgrade a Web file, you need to specify the new Web file in the Boot menu after restarting the switch or specify a new Web file by using the boot web-package command. Otherwise, the Web server cannot function normally.

 

Related commands: display web package

Example

# Configure the Web file named boot.web to be with the main attribute.

<Sysname> boot web-package boot.web main

1.2.5  display boot-loader

Syntax

display boot-loader [ unit unit-id ]

View

Any view

Parameter

unit unit-id: Specifies the unit ID of a switch. You cannot choose any other number except 1 for S3100-52P Ethernet switches.

Description

Use the display boot-loader command to display the information about the APP startup files of the device. Displayed information includes the current app startup file name, and the main and backup app startup files to be used when the switch starts up next time.

Example

# Display the information about the app startup files.

<Sysname> display boot-loader unit 1

 Unit 1

   The current boot app is: switch.bin              

   The main boot app is:     switch.bin              

   The backup boot app is:   switchbak.bin           

1.2.6  display web package

Syntax

display web package

View

Any view

Parameter

None

Description

Use the display web package command to display information about the Web file used by the device, including the name of the currently used Web file, and the name of the Web files with the main and backup attributes used for next startup.

Example

# Display information about the Web file used by the device.

<Sysname>display web package

The current using web package is: flash:/h3c-http3.1.5-0040.web

The main web package is: unit1>flash:/h3c-http3.1.5-0040.web

The backup web package is: unit1>flash:/

1.2.7  startup bootrom-access enable

Syntax

startup bootrom-access enable

undo startup bootrom-access enable

View

User view

Parameter

None

Description

Use the startup bootrom-access enable command to specify a switch to prompt users to use customized password to enter the BOOT menu.

Use the undo startup bootrom-access enable command to disable the above function.

By default, users have to use customized passwords to enter the BOOT menu.

You can use the display startup command in the Configuration File Management part of the manual to view the execution results of these two commands.

Example

# Specify to prompt users to use customized passwords to enter the BOOT menu.

<Sysname> startup bootrom-access enable

<Sysname> display startup

UNIT 1:

  Current Startup saved-configuration file:          flash:/config.cfg

  Next main startup saved-configuration file:        flash:/config.cfg

  Next backup startup saved-configuration file:      NULL

  Bootrom-access enable state:                       enabled

 

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
All Support
  • Become a Partner
  • Partner Resources
  • Partner Business Management
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网