Huh? tar doesn't compress files; it compounds them into an archive. Yes, it
supports on-the-fly compression of that archive, but it relies on other tools,
(separate programs), to do the job. OTOH, in the case of bsdtar, AKAIK, the
compression filters are built in, using functions from libarchive.
Notwithstanding that bsdtar may be a better choice, the OP's command line
syntax is wrong for either -- the mandatory archive name argument, (promised
by the 'f' option), has been omitted! It should be:
The .tar.gz extension isn't mandatory, but is recommended for gzipped
archives, (the 'z' option); use .tar.bz2 for bzipped archives, ('j' option),
.tar.lzma for lzma or .tar.xz for xz compressed archives, (don't know if
GnuWin32 supports those yet).
Also note some gotchas:
1) Never specify absolute path names, in subdir-or-list-of-files ...
2) If you want to back up all files in a directory, (as the OP's .
indicates), prefer to run tar in the parent directory, and specify the name of
the subdir to back up.
3) tar, (and bsdtar), will recurse into any subdirectories which match a
wildcard spec in the files list.
4) Never specify the archive-name to reside in the same directory as files
specified by wildcard, or in any subdirectory which may be recursed.
5) If backing up everything from the root of a drive, be sure to place the
archive on a different drive, (and be sure that it has sufficient free space).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
FWIW, the OP's original examples indicate two distinct problems with
GnuWin32's tar implementation: in the first instance, it is failing to spawn a
gzip child process, to compress the archive; in the second, it appears to be
attempting to recurse the parent directory tree, via the chain of '..' links,
(so becoming a malformed entire drive archive), failing when it tries to enter
a directory for which the OP lacks access privilege. This simply should not
happen: on nix, '.*' doesn't match '..' or '.' anyway, but furthermore, IIRC
tar isn't supposed to recurse through '..' links, (although it may follow one
specified among the command line arguments).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
C:\path\to\files>c:\gnuwin32\tar -czvf .
c:\gnuwin32\tar: Cannot fork: Function not implemented
c:\gnuwin32\tar: Error is not recoverable: exiting now
C:\path\to\files>c:\gnuwin32\tar -cvf .
..\package\tar: Cannot open subfolder: Permission denied
..\package\tar: Error is not recoverable: exiting now
I have no clue how to compress files with tar. I try, I get the above errors,
and, in short, I haven't a clue. Any ideas?
Use bsdtar (http://gnuwin32.sourceforge.net/packages/libarchive.htm). In fact, the tar
package page itself (http://gnuwin32.sourceforge.net/packages/gtar.htm) recommends this!
Huh? tar doesn't compress files; it compounds them into an archive. Yes, it
supports on-the-fly compression of that archive, but it relies on other tools,
(separate programs), to do the job. OTOH, in the case of bsdtar, AKAIK, the
compression filters are built in, using functions from libarchive.
Notwithstanding that bsdtar may be a better choice, the OP's command line
syntax is wrong for either -- the mandatory archive name argument, (promised
by the 'f' option), has been omitted! It should be:
or:
The .tar.gz extension isn't mandatory, but is recommended for gzipped
archives, (the 'z' option); use .tar.bz2 for bzipped archives, ('j' option),
.tar.lzma for lzma or .tar.xz for xz compressed archives, (don't know if
GnuWin32 supports those yet).
Also note some gotchas:
1) Never specify absolute path names, in subdir-or-list-of-files ...
2) If you want to back up all files in a directory, (as the OP's .
indicates), prefer to run tar in the parent directory, and specify the name of
the subdir to back up.
3) tar, (and bsdtar), will recurse into any subdirectories which match a
wildcard spec in the files list.
4) Never specify the archive-name to reside in the same directory as files
specified by wildcard, or in any subdirectory which may be recursed.
5) If backing up everything from the root of a drive, be sure to place the
archive on a different drive, (and be sure that it has sufficient free space).
FWIW, the OP's original examples indicate two distinct problems with
GnuWin32's tar implementation: in the first instance, it is failing to spawn a
gzip child process, to compress the archive; in the second, it appears to be
attempting to recurse the parent directory tree, via the chain of '..' links,
(so becoming a malformed entire drive archive), failing when it tries to enter
a directory for which the OP lacks access privilege. This simply should not
happen: on nix, '.*' doesn't match '..' or '.' anyway, but furthermore, IIRC
tar isn't supposed to recurse through '..' links, (although it may follow one
specified among the command line arguments).