< Home

rename (user view)

Function

The rename command renames a file or folder.

Format

rename old-name new-name

Parameters

Parameter

Description

Settings

old-name

Specifies the name of a file or folder.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] filename format.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. The directory name cannot contain the following characters: ~ * / \ : ' "

new-name

Specifies the new name of the file or directory.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] [ path ] filename format.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. The directory name cannot contain the following characters: ~ * / \ : ' "

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

The following describes the drive name:

  • drive is the storage device and is named as flash:.

  • If devices are stacked, drive can be named as:

    • flash: root directory of the flash memory of the master switch in the stack.
    • chassis ID#flash: root directory of the flash memory on a device in the stack.

    For example, slot2#flash: indicates the flash memory in slot 2.

The path can be an absolute path or relative path. A relative path can be designated relative to either the root directory or the current working directory. A relative path beginning with a slash (/) is a path relative to the root directory.
  • flash:/my/test/ is an absolute path.

  • /selftest/ is a path relative to the root directory and indicates the selftest directory in the root directory.

  • selftest/ is a path relative to the current working directory and indicates the selftest directory in the current working directory.

Precautions

  • You must rename a file or directory in its source directory.

  • If the renamed file or directory has the same name as an existing file or directory, an error message is displayed.

  • If you specify old-name or new-name without specifying the file path, the file must be saved in your current working directory.

Example

# Rename the directory mytest to yourtest in the directory flash:/test/.

<HUAWEI> pwd
flash:/test 
<HUAWEI> rename mytest yourtest
Rename flash:/test/mytest to flash:/test/yourtest ?[Y/N]:y
Info: Rename file flash:/test/mytest to flash:/test/yourtest ......Done. 

# Rename the file sample.txt to sample.bak.

<HUAWEI> rename sample.txt sample.bak
Rename flash:/sample.txt to flash:/sample.bak ?[Y/N] :y
Info: Rename file flash:/sample.txt to flash:/sample.bak .......Done.
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >