tags:

views:

22

answers:

1

I wonder how to list the content in an archive file and remove some directories from it?

For example, I have an archive file data.tar.

  1. I would like to list its content without extracting it. Is it possible to control the level of directory for viewing? I mean not necessarily every files, but just down to some level of the path.

  2. I also would like to remove some directories matching "*/count1000" from it.

Thanks and regards!

+3  A: 

to see the contents of the tar file,

tar tvf mytar.tar

to extract a file,

tar xvf mytar.tar myfile.txt

to delete a file

tar -f mytar.tar --delete */count1000
ghostdog74
How to remove some directories matching "*/count1000" from it.
Tim
Is it possible to control the level of directory for viewing? I mean not necessarily every files, but just down to some level of the path. Thyanks
Tim