APK Batch Rename Tool (for Windows and Linux)

djmcnz

Retired Recognized Developer
Oct 13, 2009
5,683
1,635
253
Auckland, NZ
Oh nice, why didn't I see this before? :rolleyes:

I need to make minor adjustments to the script for my purposes but it's an excellent base to work from.

Thanks! :cool:
 

pejman999

Member
Sep 30, 2009
27
0
21
hi guys.
such a great soft.
but I have a big problem.
Norton Internet security 2011 finds it as Sonar activity.
what should I do?
Any help will be appreciated .
sorry for bad English language.
 

drsood

Senior Member
Oct 25, 2010
317
38
48
hi guys.
such a great soft.
but I have a big problem.
Norton Internet security 2011 finds it as Sonar activity.
what should I do?
Any help will be appreciated .
sorry for bad English language.
yup it does...i just ran the tool and norton detected sonar activity...but i uploaded that particular file on virustotal.com and no other antivirus reported it as virus...i gues its safe to add it in exclusion list of norton
 

phsorx

Member
Nov 13, 2010
16
55
0
Norton Internet Security

yup it does...i just ran the tool and norton detected sonar activity...but i uploaded that particular file on virustotal.com and no other antivirus reported it as virus...i gues its safe to add it in exclusion list of norton
Hi pejman999 & drsood!

Sonar activity report from Norton :mad: is obviously a false alarm. But anyways... Can you tell me which file Norton dislikes? Is it a .bat or an .exe file? (Please, check your quarantine.) I will have a look if I could possibly drop and substitute it in future releases.

Thanks,
Phsorx

For the interest of the (few (remaining)) Norton users out there:
  1. Binaries are bundled to help ease of use. That is, to get this thing work "out of the box" w/o the need for separately downloading all dependencies.
  2. If you feel uneasy to use the binaries bundled and located in the tools folder, you may download them separately from their original sources. For this very purpose I added a note in \tools\binaries.txt with all the original URI's I got the binaries from. :cool:
 

drsood

Senior Member
Oct 25, 2010
317
38
48
Hi pejman999 & drsood!

Sonar activity report from Norton :mad: is obviously a false alarm. But anyways... Can you tell me which file Norton dislikes? Is it a .bat or an .exe file? (Please, check your quarantine.) I will have a look if I could possibly drop and substitute it in future releases.

Thanks,
Phsorx
Its rev.exe
thanks
 

jjwa

Senior Member
Jun 24, 2010
220
10
0
35
Enschede
I am still making use of this tool :).

Thanks!

No complains about it either. The only improvement that I could thing of, would be being able to add the names of the Market category the app is in, to the filename (or folder name even). Is that information saved in the apps, or would you have to figure out a much more complex solution for that, pulling the information off of the Market itself?

Hi!

It might have been duplicate input apps. Only one copy is kept in output folder. Read known issues and roadmap section of howto txt. A new version is under way and will be released very soon that will save duplicates separately with an extra .1 .2 .3 ... .n extension; so if you throw 500 files at it, you will exactly get 500 files back and it will be up to you to sort out or dispose of duplicates.

phsorx

Sent from my HTC Desire using XDA App
A second reason some apps don't appear in the output, is names that are (far) too long. For example Vignette does this. They seem to save their complete changelog stories in the spot where only a version number is supposed to go.
 
Last edited:

rezam

Senior Member
Feb 10, 2008
129
11
48
41
Mashhad
Thanks , That is very useful program
Is it possible to make an android version of this program ? That we can use it on our phone.
(A batch apk renamer for android mobile phones)
 

thangnh

Senior Member
Mar 17, 2010
130
3
0
Hi!

Did you click the ApkBatchRename.Bat or ApkRename.Bat?
(Should click ApkBatchRename.Bat!)

ApkBatchRename.Bat accepts no command line arguments. You can run it by simply clicking it. This is the file supposed to be executed, and it will do the job. What it does is it searches through the input folder and its sub folders for *.apk files and invokes ApkRename.Bat with the appropriate command line arguments on it. After all iterations it will prompt you for a key press prior exiting.

ApkRename.Bat on the other hand does need command line arguments. Simply clicking it will briefly open the command dialog, scroll the help message and close. (Like you said.) The best way to invoke ApkRename.Bat (if you definitely have to) is from the command prompt. To get a command prompt on Windows 7 click start and enter cmd into the search box in the start menu. ApkRename.Bat will show a short help explaining what arguments it takes. ApkRename.Bat will work on one file at a time only. It is ApkBatchRename.Bat that does the recursion for him.

Hope this helped.

phsorx

PS: Make sure your apk file is a valid zip file though! All apk files are actually zip archives with multiple files in them. If you cannot open your apk file in a zip file manager such as 7zip or winzip that means your package file is corrupted. In such a case Apk(Batch)Rename will not work either, because it starts by opening the zip archive to pull the Label and Version information. Did you try with other apk's as well?

PS2: I haven't tested the tool on Windows7 x64 yet though. I'll too have a look if that could be your issue. Nubicurio confirmed the tool works on his x64 machine. Thanks Nubicurio!
I can't get this to work. I put all my .apk files into a folder named "apk", must I change the name of that folder to "Input"? Where should I copy all files of the Apk rename tool relatively to apk files folder to for it to work?
Thank you.
 

bernabap

Senior Member
Jul 25, 2009
217
16
0
phsorx,

I changed your linux version to rename as britoso indicated but I could not make your script rename the label without 'spaces'. Is this possible?

from now I get: "Hello World!_1.21_com.android.vendor.apk" with 'space' between Hello World
I would like to see: "Hello_World!_1.21_com.android.vendor.apk" with '_' between Hello World

This is how I did:

#!/bin/bash
o="$2"
label=
version=
package=

[ "$1" = "" ] &&
{

echo """
ApkRename - V1.10 Linux - PhSorx ([email protected]) - 11-17-2010 -

apkrename [path/]infile [output-folder]

ApkRename takes Label, Version info and Package name from an Android Package (.apk) file
and creates a copy with it under output-folder or current folder if omitted.

Eg: apkrename.exe com.example.hw.apk
Having Label=\"Hello World!\", Version=\"1.21\", Package=\"com.android.vendor\" creates \"Hello World!_1.21_com.android.vendor.apk\"
"""

}||{

[ "$2" = "" ] && o=.

label=`tools/aapt d badging "$1"|grep "application: label="|cut -d\' -f2-|tools/rev|cut -d\' -f4-|tools/rev|tr -dc [A-Za-z0-9-_.!\'~+[:blank:]]`

[ "$label" = "" ] &&
label=`tools/aapt d badging "$1"|grep "launchable activity name="|cut -d\' -f4-|tools/rev|cut -d\' -f4-|tools/rev|tr -dc [A-Za-z0-9-_.!\'~+[:blank:]]`

[ "$label" = "" ] &&
label=Unknown

version=`tools/aapt d badging "$1"|grep "versionName="|cut -d\' -f6`

[ "$version" = "" ] &&
version=0.0.0

package=`tools/aapt d badging "$1"|grep "package: name="|cut -d\' -f2`

[ "$package" = "" ] &&
label=Unknown

echo $label $version $package

cp "$1" "$o/$label"_"$version"_"$package.apk"

}


I am using pyRenamer tool to remove 'spaces' from my apks but would be nice to have on your script I just dont know how to do it.
 

phsorx

Member
Nov 13, 2010
16
55
0
spaces to underscores in the filenames

Hi Bernabap!

To replace spaces with underscores just inject a tr command to do the job. :rolleyes:

Code:
label=`echo $label|tr ' ' '_'`
Place that line just before the end section, like so:

Code:
label=`echo $label|tr ' ' '_'`
echo $label $version $package
cp "$1" "$o/$label"_"$version"_"$package.apk"
Watch the exact punctuation though! The apostrophe ( ' ) is different from ( ` ) etc.

I would copy-paste it, if I were you. :cool:

I did not try if it worked, :D but tell me how it went!

phsorx
 
  • Like
Reactions: bernabap

thangnh

Senior Member
Mar 17, 2010
130
3
0
I can't get this to work. I put all my .apk files into a folder named "apk", must I change the name of that folder to "Input"? Where should I copy all files of the Apk rename tool relatively to apk files folder to for it to work?
Thank you.
Dear all, Sorry for being a noob, but I can't make this to work. I'm using Win7 x64. Can you provide some hepl? Thanks a lot.

Symptoms: I unzip all files to same folder with my apk collection (folder name is "apk"), run the apkbatchrename.bat, in less than a second I got the below messages, hit any key, cmd window closes and nothing happens.

===
APK Batch Rename Tool V1.10

Starting to copy files...


Completed. Now check output directory.

Press any key to continue . . .
===
 
Last edited:

phsorx

Member
Nov 13, 2010
16
55
0
Place all apk files into the input folder

Hi thangnh,

:) :) :) I guess it is really time for me to do a video tutorial on youtube, isn't it!? :) :) :)

So when you unzip ApkRename1.10.zip you get this folder structure:

Code:
ApkRename
├───input
├───output
└───tools
Now copy your apk file(s) into the input folder like so:

Code:
ApkRename
├───input
│   └───hello.apk
├───output
└───tools
And now execute the ApkBatchRename.bat file (eg by simply double clicking it).

Result:
Code:
ApkRename
├───input
│   └───hello.apk
├───output
│   └───Hello World 1.21.apk
└───tools
Now you can find you freshly renamed app(s) under the output folder.

Also note:
You can also place multiple files and folders of your app collection into the input folder. Such sub-folder trees within input will be walked recursively.

Hope this helped.

phsorx
 
  • Like
Reactions: thangnh

wornbat

Senior Member
Jun 21, 2006
132
6
0
Sydney
I ran into an issue with this script with one apk file. The file contained a | in the version field which caused the batch file to try and execute the next parameter.

How can I modify the script to stop this from happening as it stops the whole process when this happens.

D:\Down\backup>ApkRename.bat "D:\Down\backup\input\com.ccpcreations.android.VLW-
1.apk" output
'bug' is not recognized as an internal or external command,
operable program or batch file.

The Version field of this apk shows:
0.83b: new feature: rendering mode | bug fix: memory leak

Thanks
Wombat
 

thangnh

Senior Member
Mar 17, 2010
130
3
0
Hi thangnh,

:) :) :) I guess it is really time for me to do a video tutorial on youtube, isn't it!? :) :) :)

So when you unzip ApkRename1.10.zip you get this folder structure:

Code:
ApkRename
├───input
├───output
└───tools
Now copy your apk file(s) into the input folder like so:

Code:
ApkRename
├───input
│   └───hello.apk
├───output
└───tools
And now execute the ApkBatchRename.bat file (eg by simply double clicking it).

Result:
Code:
ApkRename
├───input
│   └───hello.apk
├───output
│   └───Hello World 1.21.apk
└───tools
Now you can find you freshly renamed app(s) under the output folder.

Also note:
You can also place multiple files and folders of your app collection into the input folder. Such sub-folder trees within input will be walked recursively.

Hope this helped.

phsorx
I finally have it worked. The problem before was that I unzipped the file without keeping folder structures, hence I got no idea there supposed to be input/output/tools folders. Thanks a bunch.