Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

what I am trying to do is to compress a list of files using tar.

So what I am doing is

sudo tar -pcf filename.tgz `cat filename.list`

so if there is a directory on the list like this

/home/vmuser/.gconf

tar compresses everything in that folder. However what I want is to just add exactly whatever is on the list.

share|improve this question
    
Sorry, but I'm not clear on why you don't just take the directory name off filename.list if you don't want that directory's contents to be tar'ed. What am I missing? –  John S Gruber Aug 22 '12 at 5:02
    
Note that tar does not actually compress files, it just puts them all into one file (this is called archiving the files). Just naming the output file .tgz will not cause the file to be compressed - you will also need to use the z flag (i.e. tar pczf filename.tgz) which compresses the resulting tar file using gzip. –  Steve Kroon Aug 22 '12 at 9:13
    
Do you want to tar the info in the folder inode, or do you just want to skip folders in the file list? –  Steve Kroon Aug 23 '12 at 7:05

1 Answer 1

From the tar(1) man page:

   --no-recursion
          avoid descending automatically in directories
share|improve this answer
    
:I am not clear on the answer you gave. Can you edit your response to include the instructions needed to answer the question, and maybe sugeest how this will resolve it? –  Stephen Myall Aug 22 '12 at 12:22
    
tar --no-recursion ... It will solve it because tar will not recurse subdirectories. –  Ignacio Vazquez-Abrams Aug 22 '12 at 14:38

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.