Skip to content

Instantly share code, notes, and snippets.

@MrPowerGamerBR
Created January 3, 2016 11:02
Show Gist options
  • Select an option

  • Save MrPowerGamerBR/0eb29756ccdb55946f58 to your computer and use it in GitHub Desktop.

Select an option

Save MrPowerGamerBR/0eb29756ccdb55946f58 to your computer and use it in GitHub Desktop.
import zipfile
import os;
for allFilesJar in os.listdir(os.path.dirname(os.path.realpath(__file__))):
if allFilesJar.endswith(".jar"):
print allFilesJar;
archive = zipfile.ZipFile(allFilesJar)
for file in archive.namelist():
if file.startswith('config'):
if not os.path.exists(os.path.splitext(allFilesJar)[0]):
os.makedirs(os.path.splitext(allFilesJar)[0])
archive.extract(file, os.path.dirname(os.path.realpath(__file__)) + "/" + os.path.splitext(allFilesJar)[0])
os.rename(os.path.dirname(os.path.realpath(__file__)) + "/" + os.path.splitext(allFilesJar)[0] + "/" + file, os.path.dirname(os.path.realpath(__file__)) + "/" + os.path.splitext(allFilesJar)[0] + "/config.yml")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment