I have seen this question but I need something else.
My files contains a very large amount of text files (hundreds of thousands) organized by variable name.
Something like
filename/maxvalue/IDXstation.txt (with X that goes from 100000 to 200000)
filename/minvalue/IDXstation.txt
filename/meanvalue/IDXstation.txt
and so on.
Problem is that I don't have a readme.txt files that tells me how many folders are in the tar files or how they are named (I made them up) (or how many stations are in each folder).
For now all I care to read is the structure of the filename.tar.gz and print something like
filename/maxvalue/
filename/minvalue/
filename/meanvalue/
I need to read the structure of it before I start extracting the file, because I am interested only in some folders and not all of them.
if I use
for tarinfo in tar:
print tarinfo.name
It will print all the files, and they are hundreds of thousands and I don't want that, but I am not sure how to set it up.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…