tar create

Use tar create to archive files and folders.

Syntax

tar create [ gz ] archive-file fileurl-dest [ verbose ] source fileurl-source-list&<1-5>

Views

User view

Predefined user roles

network-admin

mdc-admin

Parameters

gz: Uses gzip to compress the files and folders before archiving them.

archive-file fileurl-dest: Specifies the archive file name. If you specified the gz keyword, the suffix of this argument must be .tar.gz. If you did not specify the gz keyword, the suffix of this argument must be .tar.

verbose: Displays the names of the successfully archived files and folders.

source fileurl-source-list&<1-5>: Specifies the files and folders to be archived. The fileurl-source-list argument can be a space-separated list of up to five items. Each item can be a file or folder name.

Examples

# Archive file a.cfg to file a.tar.

<Sysname> tar create archive-file a.tar source a.cfg
Creating archive a.tar …… Done.

# Compress file a.cfg and archive the file to a.tar.gz.

<Sysname> tar create gz archive-file a.tar.gz source a.cfg
Creating archive a.tar.gz Done.

# Compress and archive files and folders, and display the successfully archived files and folders.

<Sysname> tar create gz archive-file a.tar.gz verbose source a.cfg a.dbm ./core
a.cfg
a.dbm
./core

Related commands

tar extract

tar list