Created
October 12, 2018 19:34
-
-
Save meshula/845fa6cad9c1cfb8edcd141e4ccffa32 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import walk | |
import os, errno | |
import subprocess | |
sevenzip="7z.exe" | |
src="C:/Downloads/UnzippedRPMDirectory" | |
dir = os.getcwd() | |
files = [] | |
for (dirpath, dirname, filenames) in walk(src): | |
files.extend(filenames) | |
rpms = [] | |
for file in files: | |
crumbs = os.path.splitext(file) | |
if crumbs[-1] == ".rpm": | |
if not os.path.exists(crumbs[0]): | |
os.makedirs(crumbs[0]) | |
os.chdir(crumbs[0]) | |
sys = subprocess.Popen([sevenzip, "e", "-y", os.path.join(src, file)]) | |
sys.communicate() | |
cpio = crumbs[0] + ".cpio" | |
if os.path.exists(cpio): | |
sys = subprocess.Popen([sevenzip, "e", "-y", cpio]) | |
sys.communicate() | |
os.chdir(dir) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment