0

I have four folders/tar and i want to tar them into a single tar.gz. I am using common-compress to tar.gz the folder/tar(which mean tar.gz a single folder/tar). Here my challenge is, I don't know how to put in code the four folders/tar names (name of the folder/tar) to compress into a single tar.gz

For example: I have a list of folders a,b,c,d,e,f,g, and I want to tar.gz the folders a,b,c,d.

Kindly help me how to specific the selected folders in code.

Chris Martin
  • 30,334
  • 10
  • 78
  • 137
John
  • 121
  • 1
  • 7
  • thanks for the reply, but is it any way possible to hardcode the folder names in an variable so that i can tar.gz using the variable. – John Sep 17 '15 at 01:01
  • gzip can only compress a single file (which is why a tar file is used first). I don't know what library you use to .tar your folders, but taring 4 folders should not be more complicated than taring 1. – njzk2 Sep 17 '15 at 01:05
  • Take a look at answer here: http://stackoverflow.com/questions/13461393/compress-directory-to-tar-gz-with-commons-compress . If you need to have 4 folders on top level of tar file then run addFileToTarGz method 4 times (or in loop) in that example. – rsutormin Sep 17 '15 at 04:50

0 Answers0