'Extract tar.gz archive into different folders (due to limitations)
here is my original code:
import tarfile
file = tarzip.open(r'directory')
file.extractall(r'directory')
But I received the exception, because the target folder had limitation to 400k files.
Could you, please, advice me, how to split the extract into 6 different folders (archive has ~1.5m xml files)?
Thank you in advance!
Solution 1:[1]
You can loop over all the files in the archive using file.getmembers() or file.getnames(). Inside the loop use file.extract() to extract the file to wherever you want to.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sören |
