zip

Function

The zip command compresses a file.

The unzip command decompresses a file.

Format

zip source-filename destination-filename

Parameters

Parameter Description Value
source-filename

Specifies the name of the source file.

The value is a string of case-sensitive characters in the format of [ <drive> ][ <path> ][ <file-name> ]. An absolute <path> name is a string of 1 to 255 characters. A relative <path> name is a string of 1 to 128

characters. Up to 8 levels of directories are supported.

An absolute <path> is in the format of <drive> [ <path> ][ <file-name> ], and a relative <path> is in the format of [ <path> ][ <file-name> ]. That is, a relative <path> is the root <path> of the current working <path>.

destination-filename

Specifies the name of the destination file.

The value is a string of case-sensitive characters in the format of [ <drive> ][ <path> ][ <file-name> ]. An absolute <path> name is a string of 1 to 255 characters. A relative <path> name is a string of 1 to 128

characters. Up to 8 levels of directories are supported.

An absolute <path> is in the format of <drive> [ <path> ][ <file-name> ], and a relative <path> is in the format of [ <path> ][ <file-name> ]. That is, a relative <path> is the root <path> of the current working <path>.

Views

User view

Default Level

3: Management level

Task Name and Operations

Task Name Operations
rpm execute

Usage Guidelines

Usage Scenario

  • To save a large file with fewer memory resources occupied, you can run the zip command to compress the file.
  • To view the contents of a compressed file, you can run the unzip command to decompress the file.
  • Files can be compressed or decompressed on the local board or on other boards.

Precautions

If the directory but not the target file name is specified, the target file uses the source file name. After a file is compressed, the file still exists.

If the target file requires high security, you are advised to encrypt the file.

Only a single file can be compressed or decompressed.

Example

# Compress file1.txt into file1.zip in the directory of the master main control board.
<HUAWEI> zip file1.txt file1.zip
Info: Compress cfcard:/file1.txt to cfcard:/file1.zip? [Y/N]:Y
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic