1

I need to archive and compress a large number of files but some of those files may have extended attributes whose content I don't want to lose.

My understanding is that zip doesn't do that. Is there something that does?

I believe that some versions of tar support extended attributes, but I'd prefer being able to access individuals files in the archive without having to decompress the entire archive as I have to with tar.

This is Linux only.

Johannes Ernst
  • 1,037
  • 4
  • 16
  • 26

1 Answers1

0

I'm using absolute paths here:

Use tar:

tar --xattrs cjf file.tar.bz2 /path/to/files

For extract a file:

tar xjf file.tar.bz2 path/to/files/dir/file-to-extract -C /

Cheers!

  • My understanding is that even if you put decompress and extract into the same tar command (xj), tar still needs to decompress the entire file before it can extract, or at least until it finds the file, as tar doesn't have a directory like zip does. Something I'd like to avoid. – Johannes Ernst Jul 16 '15 at 16:15
  • So you are looking for something like this: http://serverfault.com/questions/59795/is-there-a-smarter-tar-or-cpio-out-there-for-efficiently-retrieving-a-file-store but with --xattrs right? – FarDarkMist Jul 17 '15 at 15:06
  • Actually just zip with --xattrs because zip otherwise does everything I need. – Johannes Ernst Jul 19 '15 at 00:36