import
subprocess
file_path
=
r
"C:\Users\yuyu\Desktop\asd.apk"
file_name
=
'AndroidManifest.xml'
output_dir
=
r
'C:/Users/yuyu/Desktop/yourapp'
zip7z
=
r
"D:\exe\tools\7z\7-Zip\7z.exe"
import
os
def
findAllFile(base):
for
root, ds, fs
in
os.walk(base):
for
f
in
fs:
if
f.endswith(
'.apk'
):
fullname
=
os.path.join(root, f)
yield
fullname
old_name
=
"J:/http_Down/1.txt"
new_name
=
"5.exe"
def
my_rename(old_name, new_name):
(path, filename)
=
os.path.split(old_name)
print
(filename)
print
(path)
new_name
=
path
+
"\\"
+
new_name
os.rename(old_name, new_name)
def
main():
base
=
'H:\\apk'
for
i
in
findAllFile(base):
print
(i[
len
(
'H:\\apk\\'
):])
cmd
=
[r
"D:\exe\tools\7z\7-Zip\7z.exe"
,
'x'
, i,
"-o"
+
output_dir, file_name]
sp
=
subprocess.Popen(cmd, stderr
=
subprocess.STDOUT, stdout
=
subprocess.PIPE)
sp.communicate()
try
:
xmlname
=
output_dir
+
"/"
+
file_name
my_rename(xmlname,i[
len
(
'H:\\apk\\'
):]
+
".xml"
)
except
Exception as e:
print
(e)
main()