by Ricardo “Rudxain” Fernández Serrata
Version 7 (January 9, 2023)
Download (261 downloads)
Powerful, simple, fast and minified. All thanks to a shell script and Fork blocks. With a variety of ways of copying APKs.
How the script algorithm works:
0. The list of package names is stored in the `ls` shell variable.
1. The directory "./APK/" is created, only if it doesn't exist.
2. For each pkg name, the list of URIs (usually just 1) of APKs associated with the input package name is stored in the `path` shell variable, as a line-delimited string.
3. If `path` is empty, it means the app doesn't exist at all, or hasn't been found to have an APK associated with it. So print an error message, otherwise continue normally.
4. The `path` var is splitted by its lines and converted to an array of strings instead of a "flat string".
5. The first array element of `path` (the 1st line) is selected, the "package:" URI scheme is removed (its length is 8), then read by `cp` cmd as the source path to copy. The file is copied into "./APK/" and gets named as its package-name with the ".apk" file extension.
If the script doesn't work on your device, it's very likely that you have a different version/update or an entirely different shell altogether. I wrote this script to be compatible with Android's flavor of MirBSD Korn Shell (MKSH). Old Androids use ASH. And newer Androids may use a different shell, like Bash and Dash
Rate and review within the app in the Community section.