How can the directories on the level one can be listed in a tar.gz archive? E.g. \dir1\ \dir2\ \dir3\ \dir4\ \dir1\
Not \dir1\bla \dir1\bla2
You can use the --exclude
option to exclude everything that's within a directory.
tar tfz archive.tar.gz --exclude '*/*'
Example:
[me@home]$ tar tfj CUnit-2.1-2-src.tar.bz2 | head -n5
CUnit-2.1-2/
CUnit-2.1-2/NEWS
CUnit-2.1-2/Makefile.am
CUnit-2.1-2/configure
CUnit-2.1-2/cunit.pc.in
[me@home]$ tar tfj CUnit-2.1-2-src.tar.bz2 --exclude '*/*'
CUnit-2.1-2/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With