Cannot Generate .tar File

3

1

How do I make a .tar from current directory tree in Win10? Trying tar -c Archive.tar * and getting tar: Failed to open '\\.\tape0'.

C:\>tar -h
tar(bsdtar): manipulate archive files
First option must be a mode specifier:
  -c Create  -r Add/Replace  -t List  -u Update  -x Extract
Common Options:
  -b #  Use # 512-byte records per I/O block
  -f <filename>  Location of archive (default \\.\tape0)
  -v    Verbose
  -w    Interactive
Create: tar -c [options] [<file> | <dir> | @<archive> | -C <dir> ]
  <file>, <dir>  add these items to archive
  -z, -j, -J, --lzma  Compress archive with gzip/bzip2/xz/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
List: tar -t [options] [<patterns>]
  <patterns>  If specified, list only entries that match
Extract: tar -x [options] [<patterns>]
  <patterns>  If specified, extract only entries that match
  -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)
bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.5.f-ipp

flywire

Posted 2018-09-20T03:04:02.263

Reputation: 55

Answers

2

-f <filename>  Location of archive (default \\.\tape0)

You missed -f so tar used the default location (treating Archive.tar as a file to be archived). Your command should be like

tar -cf Archive.tar *

although I don't know PowerShell's rules of usage of *. You may try to pass -- just before * to make tar stop parsing options, I hope your tar understands this. This is in case * returns something which initial part looks like options for tar.

Kamil Maciorowski

Posted 2018-09-20T03:04:02.263

Reputation: 38 429

Can you past full command line as example? – flywire – 2018-09-20T03:11:34.673

tar: Can't launch external program: bzip2 same without -j and tar extension. M$ - Grrr. tar -cf Archive www worked. – flywire – 2018-09-20T03:24:10.807

Yes file issue resolved but still doesn't generate bz2 format, just tar packed format. M$ introduced tar in Mar'18. tar -h implies bz2 is available. – flywire – 2018-09-20T03:45:05.040

Let us continue this discussion in chat.

– Kamil Maciorowski – 2018-09-20T03:45:58.260