LoginSignup
1
1

More than 3 years have passed since last update.

pythonを使ってtargzファイルを展開する

Last updated at Posted at 2019-12-07

Windowsでtargzファイルを展開したいなあと思っていたところ、以下のやり方でできるようなので記録しておきます。

extract_from_targz.py
import tarfile
import sys

args = sys.argv

with tarfile.open(args[1], "r:gz") as file:
    file.extractall(path=args[2])
    file.close()
>python extract_from_targz.py <targzファイル名> <展開後のディレクトリ名>
1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1