mirror of
https://github.com/Relintai/pandemonium_engine_easy_charts.git
synced 2024-12-19 13:37:03 +01:00
20 lines
761 B
Python
20 lines
761 B
Python
import glob,zipfile,shutil,os,sys,tarfile
|
|
|
|
archive = sys.argv[1]
|
|
destination = sys.argv[2]
|
|
|
|
if archive.endswith('.zip'):
|
|
with zipfile.ZipFile(archive) as zip:
|
|
for zip_info in zip.infolist():
|
|
if zip_info.filename == zip.infolist()[0].filename :
|
|
continue
|
|
zip_info.filename = zip_info.filename.replace(zip.infolist()[0].filename,'')
|
|
zip_info.filename.replace(zip.infolist()[0].filename,'')
|
|
elif archive.endswith('.tar.gz'):
|
|
tar = tarfile.open(archive)
|
|
for member in tar.getmembers():
|
|
if member.name == tar.getmembers()[0].name:
|
|
continue
|
|
member.name = member.name.replace(tar.getmembers()[0].name+'/','')
|
|
tar.extract(member, destination)
|