01-Fundamentals Command Reference

HomeSupportReference GuidesCommand ReferencesH3C WX Series Access Controllers Command References(R3308 R2308)-6W10701-Fundamentals Command Reference
04-File Management Commands
Title Size Download
04-File Management Commands 130.89 KB

 

 

NOTE:

·     The storage medium type available with your device can be flash, CF card, or some other types depending on your device model. For more information, see About the WX Series Access Controllers Configuration Guides.

·     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 Fundamentals Configuration Guide.

 

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 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 cd 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. (A space is required 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 copy 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 cfa0:/test.cfg to cfa0:/testbackup.cfg?[Y/N]:y

....

%Copy file cfa0:/test.cfg to cfa0:/testbackup.cfg...Done.

# Copy file 1.cfg in the test folder on the CF card to the testbackup folder in the first partition of the CF card, and save it as 1backup.cfg.

<Sysname> copy cfa0:/test/1.cfg cfa0:/testbackup/1backup.cfg

Copy cfa0:/test/1.cfg to cfa0:/testbackup/1backup.cfg?[Y/N]:y

 

%Copy file cfa0:/test/1.cfg to cfa0:/testbackup/1backup.cfg...Done.

crypto-digest

Syntax

crypto-digest sha256 file file-url

View

User view

Default level

2: System level

Parameters

sha256: Specifies the SHA-256 algorithm.

file file-url: Name of a file.

Description

Use crypto-digest to compute the digest of a specified file.

The computed digest is used to verify the correctness and integrity of the file to prevent the file from being tampered with. For example, you can use the command to compute the digest of the software image file of a device, and compare the digest with that on the web site of the device vendor to verify whether the file is valid.

Examples

# Use the SHA-256 algorithm to compute the digest of the file 1.cfg.

<Sysname> crypto-digest sha256 file 1.cfg

Computing digest...

SHA256 digest(1.cfg)=

7bcb92458222f91f9a09a807c4c4567efd4d5dc4e4abc06c2a741df7045433eb

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 delete file-url 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.

Use delete /unreserved file-url to permanently delete a file. The deleted file cannot be restored. Use it with caution.

 

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 cfa0:/tt.cfg? [Y/N]:y

 

%Delete file cfa0:/tt.cfg...Done.

dir

Syntax

dir [ /all ] [ file-url | /all-filesystems ]

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.

/all-filesystems: Displays files and folders in the root directory of all storage media on the device.

Description

Use dir 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 cfa0:/

 

   0     -rw-  20669704  Jan 12 2011 15:17:24   wx5004.bin

   1     -rwh       739  Jan 27 2011 16:36:52   private-data.txt

   2     drw-         -  May 17 2010 11:11:32   logfile

   3     -rw-      2686  Jan 27 2011 16:36:50   system.xml

   4     -rw-     10329  May 18 2010 08:01:54   command.txt

   5     -rw-      1433  Jan 27 2011 14:49:12   startup.cfg

   6     -rwh       716  Jan 19 2011 20:01:04   hostkey

   7     -rwh       572  Jan 19 2011 20:01:04   serverkey

   8     drw-         -  Jan 21 2011 14:11:52   test

   9     -rw-      1695  Jan 27 2011 16:36:50   [test.cfg]

 

252904 KB total (232664 KB free)

[ ] indicates this file is in the recycle bin.

# Display files and folders in the root directory of all storage media on the device.

<Sysname> dir /all-filesystems

Directory of cfa0:/

 

   0     -rw-  20669704  Jan 12 2011 15:17:24   wx5004.bin

   1     drw-         -  May 17 2010 11:11:32   logfile

   2     -rw-      2686  Jan 27 2011 16:36:50   system.xml

   3     -rw-     10329  May 18 2010 08:01:54   command.txt

   4     -rw-      1433  Jan 27 2011 14:49:12   startup.cfg

   5     drw-         -  Jan 21 2011 14:11:52   test

 

252904 KB total (232664 KB free)

Table 1 Command output

Field

Description

Directory of

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.

 

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 execute 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 skips 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 file prompt 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 fixdisk to restore the space of a storage medium when it becomes unavailable because of some abnormal operation.

Examples

# Restore the space of the CF card.

<Sysname> fixdisk cfa0:

%Fixdisk cfa0: completed.

format

Syntax

format device [ FAT16 | FAT32 ]

View

User view

Default level

3: Manage level

Parameters

device: Name of a storage medium (for example flash or cf).

FAT16: Formats a storage medium using the FAT16 format. FAT16 does not support Tab matching but needs to be input completely if used, and is not applicable to a flash card.

FAT32: Formats a storage medium using the FAT32 format. FAT32 does not support Tab matching but needs to be input completely if used, and is not applicable to a flash card.

Description

Use format to format a storage medium.

 

CAUTION

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 CF card using the FAT16 format.

<Sysname> format cfa0: FAT16

mkdir

Syntax

mkdir directory

View

User view

Default level

3: Manage level

Parameters

directory: Name of a folder.

Description

Use mkdir 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 cfa0:/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 cfa0:/test

# Create folder test/subtest in the current directory.

<Sysname> mkdir test/subtest

....

%Created dir cfa0:/test/subtest

more

Syntax

more file-url

View

User view

Default level

3: Manage level

Parameters

file-url: File name.

Description

Use more to display the contents of the specified file. It indicates that there are more lines that the screen can display.

Pressing Enter displays the next line.

Pressing Space displays the next screen.

Pressing Ctrl+C or any other key exits the 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 move 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.

You cannot move files between storage media of different types.

Examples

# Move file cfa0:/test/sample.txt to cfa0:/, and save it as 1.txt.

<Sysname> move test/sample.txt 1.txt

Move cfa0:/test/sample.txt to cfa0:/1.txt?[Y/N]:y

...

% Moved file cfa0:/test/sample.txt to cfa0:/1.txt

# Move file b.cfg to the subfolder test2.

<Sysname> move b.cfg test2

Move cfa0:/b.cfg to cfa0:/test2/b.cfg?[Y/N]:y

.

%Moved file cfa0:/b.cfg to cfa0:/test2/b.cfg.

pwd

Syntax

pwd

View

User view

Default level

3: Manage level

Parameters

None

Description

Use pwd to display the current path.

Examples

# Display the current path.

<Sysname> pwd

cfa0:

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 rename 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 cfa0:/sample.txt to cfa0:/sample.bat? [Y/N]:y

 

% Renamed file cfa0:/sample.txt to cfa0:/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 reset recycle-bin 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.

1.     Display all the files in the recycle bin and in the current directory.

<Sysname> dir /all

Directory of cfa0:/

 

   0     -rw-  20669704  Jan 12 2011 15:17:24   wx5004.bin

   1     -rwh       739  Jan 27 2011 16:36:52   private-data.txt

   2     drw-         -  May 17 2010 11:11:32   logfile

   3     -rw-      2686  Jan 27 2011 16:36:50   system.xml

   4     -rw-     10329  May 18 2010 08:01:54   command.txt

   5     -rw-      1433  Jan 27 2011 14:49:12   startup.cfg

   6     -rwh       716  Jan 19 2011 20:01:04   hostkey

   7     -rwh       572  Jan 19 2011 20:01:04   serverkey

   8     drw-         -  Jan 21 2011 14:11:52   test

   9     -rw-      1695  Jan 27 2011 16:36:50   [test.cfg]

 

252904 KB total (232660 KB free)

//The output shows that the current directory is cfa0:, and the file test.cfg is in the recycle bin.

2.     Delete file test.cfg in the current directory and in the recycle bin.

<Sysname> reset recycle-bin

Clear cfa0:/~/ test.cfg ?[Y/N]:y

 

%Cleared file cfa0:/~/ test.cfg...

3.     In directory cfa0:, check whether the file test.cfg in the recycle bin is deleted.

<Sysname> dir /all

Directory of cfa0:/

 

   0     -rw-  20669704  Jan 12 2011 15:17:24   wx5004.bin

   1     -rwh       739  Jan 27 2011 16:36:52   private-data.txt

   2     drw-         -  May 17 2010 11:11:32   logfile

   3     -rw-      2686  Jan 27 2011 16:36:50   system.xml

   4     -rw-     10329  May 18 2010 08:01:54   command.txt

   5     -rw-      1433  Jan 27 2011 14:49:12   startup.cfg

   6     -rwh       716  Jan 19 2011 20:01:04   hostkey

   7     -rwh       572  Jan 19 2011 20:01:04   serverkey

   8     drw-         -  Jan 21 2011 14:11:52   test

 

252904 KB total (232668 KB free)

// The output shows that file cfa0:/test.cfg is deleted permanently.

# Delete file aa.cfg in the subdirectory test and in the recycle bin.

1.     Enter the subdirectory

<Sysname> cd test/

2.     Display all the files in the subfolder test.

<Sysname> dir /all

Directory of cfa0:/test/

 

   0     drw-         -  Jan 27 2011 16:16:24   mytest

   1     -rw-      1433  Jan 27 2011 17:05:56   testb

   2     -rw-      1433  Jan 27 2011 17:13:12   [aa.cfg]

 

252904 KB total (232660 KB free)

// The output shows that only one file exists in the folder, and the file has been moved to the recycle bin.

3.     Permanently delete file test/aa.cfg.

<Sysname> reset recycle-bin

Clear cfa0:/test/~/aa.cfg ?[Y/N]:y

 

%Cleared file cfa0:/test/~/aa.cfg...

rmdir

Syntax

rmdir directory

View

User view

Default level

3: Manage level

Parameters

directory: Name of the folder.

Description

Use rmdir to remove a folder.

The folder must be an empty one. If not, 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 cfa0:/mydir?[Y/N]:y

 

%Removed directory cfa0:/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 undelete 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 cfa0: from the recycle bin.

<Sysname> undelete a.cfg

Undelete cfa0:/a.cfg?[Y/N]:y

.....

%Undeleted file cfa0:/a.cfg.

# Restore file b.cfg in directory cfa0:/test from the recycle bin.

<Sysname> undelete cfa0:/test/b.cfg

Undelete cfa0:/test/b.cfg?[Y/N]:y

.......

%Undeleted file cfa0:/test/b.cfg.

Or, you can use the following steps to restore file cfa0:/test/b.cfg.

<Sysname> cd test

<Sysname> undelete b.cfg

Undelete cfa0:/test/b.cfg?[Y/N]:y

.....

%Undeleted file cfa0:/test/b.cfg.

 

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