python3 extract specifc tar files
hi all
I have a bunch of tar files which I have to untar and extract specific files from them.
The problem is that the tar file structured like this:
sosreport-xx.xx.xx.xx.1-some_sort_of_hashA-some_sort_of_hashB.tar.xz
---xx.xx.xx.xx.some_sort_of_hashA
-------folders/files
-------folders/files
the xx.xx.xx.xx.some_sort_of_hashA is unique to each file and I am not sure how to include that in the path for extraction.
I want to do something like this:
x = tarfile.open(sosreport)
x.extractall(full path to the file that I want).
The problem is the with the root path always in flux I am not sure how to cut that up.
Thanks in advance for all your help
|