#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2008
    Posts
    53
    Rep Power
    8

    Extract file.tar.gz to filesystem - not memory


    Hi,

    I have a large "tar.gz" file (1GB+) that needs decompressing from within a python script.

    At the moment I just
    Code:
    os.system("tar zxvf file.tar.gz")
    However, that does not catch errors - I found lots of ways to decompress a file and load it into memory - however, I don't want 1GB+ in memory, I want to decompress it directly to disk?

    Would someone be so kind as to point me in the right direction?

    Thanks
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,837
    Rep Power
    480
    You could try the command

    gunzip file.tar.gz && tar xpvf file.tar

    I won't assure you that separating the commands this way will use less memory but it seems like it might.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo