How to find a file inside device ?

asteroidg

New Member
Joined
Jan 8, 2011
Messages
8
Reaction score
0
Hi to everyone.

I need some help. I need to find a file inside device, but i have just a part of the file name . How can I find that inside the device programmaticaly ? Also my file will have the following mask file* , where * will replace the other character file name ?

What methods should I used for that ? or even some linux commands to retrieve the path of the file ?

Any help will be appreciated.

Thank you.
 

jeffv2

Developer
Developer
Joined
Dec 23, 2010
Messages
1,240
Reaction score
0
Location
south jersey
Tell us the file or part of the name

Sent from my Droid using DroidForums App
 
OP
A

asteroidg

New Member
Joined
Jan 8, 2011
Messages
8
Reaction score
0
Ok. The file name will be AndLib_AC0123456789.apk, I want to look trough all device to find the that file using just AndLib*.apk . Any suggestions or even methods will be appreciated!
 

CJM

Super Moderator
Staff member
Premium Member
Rescue Squad
Joined
Sep 12, 2010
Messages
10,604
Reaction score
1,749
Location
Mississippi Gulf Coast
Current Phone Model
Nexus 6
Twitter
https://twitter.com/Corey
If the .apk has been installed, with a file explorer on your phone (astro, root explorer, etc.) look in data\app or system\app.
If it hasnt been installed, and downloaded from the stock browser, look in the download or my downloads folders on your sd. Again with a file explorer from the phone.
If it was downloaded from another browser, like xscope, it may be in that folder on you sd. Hope this helps.
 
OP
A

asteroidg

New Member
Joined
Jan 8, 2011
Messages
8
Reaction score
0
Thank you CJM.
On my both phones(HTC-1.5, XPERIA-1.6) I just figure out that all the time when I am downloading a file it will be stored in /sdcard/download . Getting the file from a specific folder will be :

File dir = new File("/data/app");
File[] fileList = dir.listFiles();

if (fileList != null)
{
for ( int i = 0;i<fileList.length;i++)
{
filename = fileList.getName();
Log.d("FN-log","file name="+filename);

if (-1 != filename.indexOf(appName.toString()))
{
break;
}

}
}

Any way I am still looking to have a search engine , method which will look inside the whole device for a file name or masked file name .
 
OP
A

asteroidg

New Member
Joined
Jan 8, 2011
Messages
8
Reaction score
0
I have tried this too but every time i am getting the issue access is denied.I uses the following code but no luck:

try{
Process process;
process = Runtime.getRuntime().exec("su -c find / -name *.apk");
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
}
catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
 
Top