TAR.exe

Store, list or extract files in an archive (originally on tape - Tape ARchiver).
BSD TAR.exe was added to Windows 10 (1803) from build 17063 or later.

Syntax
     List:    TAR -tf archive-filename
              TAR -t [options] [patterns]

     Extract: TAR -xf archive-filename
              TAR -x [options] [patterns]

     Create:  TAR -cf archive-filename [filenames...]
              TAR -c [options] [ file | dir | @archive | -C dir ] file, dir

     Update:  TAR -rf archive-filename [filenames...]
              TAR -r [options] [ file | dir | @archive | -C dir ] file, dir

     Help:    TAR --help

The first option must be a mode specifier:
   -c   Create
   -r   Add/Replace
   -t   List
   -u   Update (alias for -r)
   -x   Extract

Common Options:
   -b #         Use # 512-byte records per I/O block.
   -f filename  Location of archive (default \\.\tape0).
   -v           Verbose.
   -w           Interactive.
   patterns     If specified, only use entries that match.

Create Options (when adding items to an archive):
   -z      Compress archive with gzip.
   -j      Compress archive with bzip2.
   -J      Compress archive with xz.
   --lzma  Compress archive with lzma.
   --format {ustar|pax|cpio|shar}  Select archive format.
   --exclude pattern  Skip files that match pattern.
   -C dir     Change to dir before processing remaining files.
   @archive   Add entries from archive to output.

Extract Options:
   -k    Keep (don’t overwrite) existing files.
   -m    Don't restore modification times.
   -O    Write entries to stdout, don’t restore to disk.
   -p    Restore permissions (including ACLs, owner, file flags).

The tar utility exits with one of the following values:
0 All files were processed successfully.
1 An error occurred.

Examples

Verbosely create a gzip archive, called sqlbackup.tar.gz, of all files matching the pattern *.sql:

C:\> tar -cvzf C:\TARS\sqlbackup.tar.gz *.sql

List the content of the gzip archive C:\TARS\sqlbackup.tar.gz:

C:\> tar -tvzf C:\TARS\sqlbackup.tar.gz

“Put three grains of sand inside a vast cathedral, and the cathedral will be more closely packed with sand than space is with stars” ~ James Jeans

Related commands

COMPACT - Compress files or folders on an NTFS partition.
IEXPRESS - Create a self extracting ZIP file archive.
MAKECAB - Create .CAB files.
Compress-Archive - PowerShell.
Zip a file - using only built-in Batch/VBS commands (Superuser.com)


 
Copyright © 1999-2024 SS64.com
Some rights reserved