zevij
zevij

Reputation: 2456

cannot tar on Mac?

I am trying to compress a log file directory on my mac. The log directory exists.

For example /var/logs/my_log_dir/

I am trying to run something like:

$ tar –cpzf x.tar.gz /var/logs/my_log_dir

I also tried other variations such as compressing only one of the files in the log dir - no luck. All I get from my mac is:

Usage:
  List:    tar -tf <archive-filename>
  Extract: tar -xf <archive-filename>
  Create:  tar -cf <archive-filename> [filenames...]
  Help:    tar --help

Thoughts?

Upvotes: 0

Views: 1534

Answers (2)

Hobbes
Hobbes

Reputation: 134

Using -p doesn't make sense in the context of compression, since you're already shoving in whatever permissions are on the files by default. When extracting, however, you can use the -p flag if you're concerned about permissions.

Compress: tar –czvf x.tar.gz /var/logs/my_log_dir

Extract: tar –xpzvf x.tar.gz

Upvotes: 2

mouviciel
mouviciel

Reputation: 67889

-p option (preserve file permissions) works in x mode only.

Upvotes: 2

Related Questions