Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have to compress only the contents of the folder, not the folder with tar, there is any argument for that? I have search but I don't find anything.

Example:

 mainfolder/
     asd1
     asd2
     subfolder/
     ....
     asdN

In my tar I want this:

  asd.tar.gz/
     asd1
     asd2
     subfolder/
     ....
     asdN
share|improve this question

1 Answer 1

up vote 3 down vote accepted

CD to "mainfolder" then execute

tar cvfz /path/your.tgz ./*
share|improve this answer
    
I want to do this out of this folder, because I am using a python script –  tato469 Oct 17 '13 at 8:50
1  
finally I did using os.chdir() (That is like cd in python) thanks. Here your first check here and welcome :) –  tato469 Oct 17 '13 at 8:53
1  
Why don't you use a python tar library? This is the more sophisticated way instead of using a system call. –  noggerl Oct 17 '13 at 8:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.