Last active
June 13, 2020 02:51
-
-
Save gamorales/7f4b509983a90440e2650b7078e8a5e4 to your computer and use it in GitHub Desktop.
Organize files from apkdecompilers.com in their respective folders
This file contains 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
import os | |
import shutil | |
source_path = '/<path>/<to>/<folder>/app-debug.apk/' | |
main_pkg_dir = './<android_project_directory_name>/' | |
def create_dir(dir_list): | |
global main_pkg_dir | |
dir_create = main_pkg_dir | |
for directory in dir_list: | |
dir_create += f'{directory}/' | |
if not os.path.exists(dir_create): | |
os.mkdir(dir_create) | |
return dir_create | |
def read_file(file_name): | |
global source_path | |
file_data = file_name.split('\\') | |
directory = create_dir(file_data[0:len(file_data)-1]) | |
shutil.copyfile(f'{source_path}{file_name}', f'{directory}{file_data[len(file_data)-1]}') | |
print(f'FROM: {source_path}{file_name} TO: {directory}{file_data[len(file_data)-1]}') | |
if __name__ == "__main__": | |
if not os.path.exists(main_pkg_dir): | |
os.mkdir(main_pkg_dir) | |
set(map(read_file, os.listdir(source_path))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment