how to use adb pull???? - Android Software Development

Hello Everyone
OK so this is a really newb question but I was confused on the syntax of the adb pull command. I know the syntax is:
adb pull <remote> <local>​I am confused on the remote an local part. Which one of these is the file to copy from the phone and which is the location to put the copied file?
Being that the command says copy files from device that would lead me to think that local would be the file you want to copy and remote is where you want the file to go, but I am not certain.
How do you structure the path to where you want to copy the file to? If it is going to the computer how do you start it, if you want to copy it to the sdcard of the phone how do you start it?
Thanks

dsMA said:
Hello Everyone
OK so this is a really newb question but I was confused on the syntax of the adb pull command. I know the syntax is:
adb pull <remote> <local>​I am confused on the remote an local part. Which one of these is the file to copy from the phone and which is the location to put the copied file?
Being that the command says copy files from device that would lead me to think that local would be the file you want to copy and remote is where you want the file to go, but I am not certain.
How do you structure the path to where you want to copy the file to? If it is going to the computer how do you start it, if you want to copy it to the sdcard of the phone how do you start it?
Thanks
Click to expand...
Click to collapse
If your using Mac OS you can use my app to do it
Anyway, remote is the device. Local is the computer. so it could be like ./adb pull /sdcard/img.jpg /user/you/desktop/
Edit: just re-read your post.
Are you saying you want to push files to the device???
that would be ./adb push (file on computer) location on device (i.e. /sdcard/ or /system/app, etc)

Related

How to push files through ADB

Prerequisites have...
A:android-sdk-windows installed
B: (on your phone) go to menu>settings>applications>developement and make sure usb debugging is checked.
C: the file you are pushing must be placed in the tools folder of adb so if you are pushing file "build.prop.txt" this needs to be downloaded/copy and pasted in C:\android-sdk-windows\tools
1: go to run and type cmd (or just open your command prompt)
2: cd C:\android-sdk-windows\tools
3: adb remount
4: adb devices *if everything is set up right this should output a serial number*
5: adb push FFFFFFF.FFF /#####/###### *i hope my notes help here you need to put the file name in for the F(s) and in the pound signs you put the destination on the devices example adb push build.prop.txt /system/bin
6. repeat step 3 for multiple files
7. adb reboot this is how you finish
usadevil7193 said:
hi mate...i m new to android..i own a nexus1..hav rooted without unlockin d bootloader..i am tryin to push d track ball to wake mod...evry time i type adb remount it says permission denied..any ideas to get things workin...???????
Click to expand...
Click to collapse
Welcome to XDA and Android! Are you trying to get help for your Nexus One? This forum here is specifically for the HTC Hero CDMA.
You will probably find better and more specific help in the Nexus One forums which are here: http://forum.xda-developers.com/forumdisplay.php?f=556
Great post, very easy to follow, thank you.
yea I'm trying to do this, over and over, but with not luck. i have sdk on my pc and im running the cmd prompt to run adb remount & devices and its not picking up the phone, wth is going on, plz help
this also works for the samsung Galaxy S in recovery mode.
mikeybonez28 said:
yea I'm trying to do this, over and over, but with not luck. i have sdk on my pc and im running the cmd prompt to run adb remount & devices and its not picking up the phone, wth is going on, plz help
Click to expand...
Click to collapse
mine shows up but then says error, device offline
hi, i have adb recognizing my phone, but i still can't seem to push the files over.... every time i try, i get 'cannot stat 'su' : No such file or directory'. i have made sure over and over to put the files in the same folder where adb is.... actually i have tried placing the files in the tools folder, as well as the platform-tools folder, and i keep getting that error when i try to push anything.
any suggestions? thx
yogi2010 said:
hi, i have adb recognizing my phone, but i still can't seem to push the files over.... every time i try, i get 'cannot stat 'su' : No such file or directory'. i have made sure over and over to put the files in the same folder where adb is.... actually i have tried placing the files in the tools folder, as well as the platform-tools folder, and i keep getting that error when i try to push anything.
any suggestions? thx
Click to expand...
Click to collapse
i had the same issue with something i was trying to push. I think you need to make sure you have exactly the same file name like caps and all. i was trying to push rootexplorer.apk and i got the same message but i then changed it to RootExplorer.apk and it work.(notice the difference in caps)
just watch this and it'll explain everything.
http://www.youtube.com/xdadevelopers
Does it matter where sdk is installed my file path is
C:\Program Files\Android\android-sdk\tools
instead of
C:\android-sdk-windows\tools.
I just installed it in the default location.
I type adb remount and get the not recognised command.....
Thanks.
I don't think my phone is being picked up?
{LCD}Stelios said:
Does it matter where sdk is installed my file path is
C:\Program Files\Android\android-sdk\tools
instead of
C:\android-sdk-windows\tools.
I just installed it in the default location.
I type adb remount and get the not recognised command.....
Thanks.
I don't think my phone is being picked up?
Click to expand...
Click to collapse
Make sure your have the drivers for your phone installed first of all.....Then, in your command prompt you have to change directories to the sdk (which you made harder by not installing to C:\
Try: cd Program Files\Android\android-sdk\tools
Then type: adb devices
That should return "xxxxxxdevice" connected....Then you know you have it set up.
Look in kyouko sig he has all the commands for adb
Sent from my HERO200 using XDA App
Bierce22 said:
just watch this and it'll explain everything.
http://www.youtube.com/xdadevelopers
Click to expand...
Click to collapse
great video arse....thanks for the help donkey
Flashing fresh ROM via ADB in Linux
Hello there.
M volumeUp and VolumeDown buttons are broken on my rooted Desire HD, so I cannot go through CWM any longer.
With regard to this post, I would ask the followings:
1) can this method be used to flash a new ROM (i.e. Coredroid, Leedroid..) without the need of those 2 buttons ?
2) My PC runs Linux. How does it work with this O.S. ?
Thanks
paolo
pacut said:
Hello there.
M volumeUp and VolumeDown buttons are broken on my rooted Desire HD, so I cannot go through CWM any longer.
With regard to this post, I would ask the followings:
1) can this method be used to flash a new ROM (i.e. Coredroid, Leedroid..) without the need of those 2 buttons ?
2) My PC runs Linux. How does it work with this O.S. ?
Thanks
paolo
Click to expand...
Click to collapse
There is a thread somewhere on how to flash without a SD card and flashed using adb I believe, but don't take my word for it. Adb works fine with Linux, just have to set it up differently. Look in my sig and select the compile aosp on Ubuntu one and follow instructions on getting the USB set up.
Sent from Dorian's HTC Hero CDMA
Yes, I saw it. It's http://forum.xda-developers.com/showthread.php?t=911228
The fact is...still have to navigate through menu via VolumeUp/volumeDown buttons
Maybe through ROM manager, premium, I can install ROM direclty.
I am gonna trying
YES ! It works !
Hi I need help. I accidentally wipped my phone in CWM and now I'm trying to use adb push to push the update.zip into my phone sd everything seems to work but then in CMW it says there are no files..
any suggestions?
[Edit]
nevermind
I kept trying different locations
not sure which one did the trick but I'll list the one's I tried
so \update.zip /sdcard/
.... /sdcard/update.zip
(note I put "/update.zip" thinking maybe it needed to be reallocated to the same file/destination
Can i use adb push *.apk /system/app to push several files at once, and then repeat but using *.odex instead of *.apk? I keep ending up getting the same error, and i want to find out which app is messing with me...
rulermon said:
Prerequisites have...
A:android-sdk-windows installed
B: (on your phone) go to menu>settings>applications>developement and make sure usb debugging is checked.
C: the file you are pushing must be placed in the tools folder of adb so if you are pushing file "build.prop.txt" this needs to be downloaded/copy and pasted in C:\android-sdk-windows\tools
1: go to run and type cmd (or just open your command prompt)
2: cd C:\android-sdk-windows\tools
3: adb remount
4: adb devices *if everything is set up right this should output a serial number*
5: adb push FFFFFFF.FFF /#####/###### *i hope my notes help here you need to put the file name in for the F(s) and in the pound signs you put the destination on the devices example adb push build.prop.txt /system/bin
6. repeat step 3 for multiple files
7. adb reboot this is how you finish
Click to expand...
Click to collapse
Hey guys ...
I have also rooted my phone , everything was OK until one day i tried to write something to /system/app and i recieve this error:
in Addition , i am writing "adb shell" and it shows me $
if i am doing adb shell --> $ --> su --> it shows #
Can some1 knows what is the problem?

[Q] RESTORING Stock Apps

So I deleted a few apps and am curious as to how I go about restoring them to the phone if I say, deleted them by accident. I made a backup of all of the apps on my pc in the SDK Tools subdirectory so they are all there. Also, will installing an .odex file be the same as an .apk file? Do I need to restore the .odex files or will they automatically be rebuilt?
How did you perform this backup? With adb? Then it will be easy to put the apps back. You should just be able to use adb with the install command. Just type in adb at the command prompt and read the help instructons for install. Not sure if the install command takes care of the .odex files. You could try it and then copy them over manually if they dont get copied. I am sure once you boot the phone the default .odex will be built, just a quess on that though.
anika200 said:
How did you perform this backup? With adb? Then it will be easy to put the apps back. You should just be able to use adb with the install command. Just type in adb at the command prompt and read the help instructons for install. Not sure if the install command takes care of the .odex files. You could try it and then copy them over manually if they dont get copied. I am sure once you boot the phone the default .odex will be built, just a quess on that though.
Click to expand...
Click to collapse
I would think that pushing the files back to the original location from recovery would be the safest bet. ADB install will install it to /data and I would think that the apps being system apps originally then they don't have the signatures anyway to allow an ADB install.
I think you're right
I believe I originally used ADB to put them in Android SDK Tools/Desktop/~ folder. When I tried installing them back I don't believe it worked. I specifically remember receiving an error when trying to install the .odex file about a database issue. Assuming it's a system file I'm trying to restore, does someone have the syntax for the push command or how I go about doing that?
If you have the .apk and .odex files on your computer, or really backed up anywhere, you can install them a few ways:
ADB Method
#Prerequisites:
Make sure you have the APK files in AndroidSDK/tools.
1. Connect the phone to your computer
2. Launch a command prompt and enter the following commands:
cd C:\AndroidSDK\tools
Replace "C:\AndroidSDK\tools" with the path to the tools folder in your SDK installation.
adb install filename.apk
Replace "filename.apk" with the name of the file you're trying to install.
Actually, **** it, the ADB method works anyway, why list a bunch lol
No wait, these are original files so you should probably put them back in their original location.
Just use "adb push filename.apk /system/app", replacing filename.apk with your filename, of course..
Push it
Okay, thanks for the tips. So I guess when you have files in the system/app directory on the phone it knows automatically to look there for program installs. This is good to know.

[Error] Unable to apply PUSH Command in ADB

Hello mates,
I am trying to Copy the BUSYBOX file to my /data/local/bin directory. But when i use the 'push' command it say adb: command not found. Hereby i have attached the image of my terminal.
Would you please help me in copying my files to the directory "/data/bin/local"
Also, where should i put the files which i need to copy. Eg. Since i need to copy 'busybox' to the /data/local/bin/, should i put the busybox in my Desktop, i.e. /home/android/platform-tools directory?
You should've not run the command from within the adb shell. Just go to the tools folder and type "adb push busybox data/local/bin" ofcourse without the ""
The busybox should be indeed be present in the folder from witch you run adb, in your case the "tool" folder.
Good luck!
Erwin
Sent from my HTC Wildfire using XDA App
@ErwinP.
Thanks for rectifying this mistake.
It worked.
You're welcome! I had to learn it the hard way myself, so I'm happy ik I can help someone! ;-)

i managed to pull the nandroid. now i need to push it back.

so i had a thread about getting these files pulled off of my buddies busted n4. but the adb command given wouldnt work and i didnt figure out how to make a tarball untill after i pulled the files. anyways...
i managed to pull the nandroid using this command - adb pull /sdcard/clockworkmod/backup/2013-08-07.23.11.28/.
what i ended up with were all of the files separately on my pc.
so if i put all of the files back into its own folder with the same name on my pc, what would be the command to push it back onto the new phone that i am about to root. using cwm.
assuming i kept the folder in platform tools. C:\androiddev\sdk\platform-tools
and do i need to create directory in the phone first? .../clockworkmod/backup/2013-08-07.23.11.28
it seems like i remember these commands, or at least i could figure it out by the commands listed, in one of the original root unlock stickies. but they seem to have been replaced with one click dealios. i need to start using adb for all of my flashing and such just so i can stop looking like an idiot for not knowing the simple stuff. in other words i would experiment and figure it out.... but i am afraid that i will just litter his phone with files and still end up coming back here.
thank you.
A quick guide to the adb pull and adb push commands:
Code:
adb pull <remote> <local>
adb push <local> <remote>
Remote being folder location on phone, local being folder location on computer.
So the correct command to pull the backup and put it into a folder under platform-tools (let's use the folder name you are using) would be this:
Code:
adb pull /sdcard/clockworkmod/backup/2013-08-07.23.11.28/ 2013-08-07.23.11.28
All you have to do to put it into it's own folder is put a space after the remote location and type whatever name you want the folder to be.
Now on to your current question. You said you pulled the files onto the computer, but they weren't in their own folder. I would put them into their own folder (we'll use 2013-08-07.23.11.28 for now) and push the contents of that folder to a folder on your phone, that we will also call 2013-08-07.23.11.28 under the backup location (If you want to make sure you have only the files contained in the backup, try re-pulling them using the above pull command. If you're pretty sure you know which ones it pulled, I wouldn't worry about it). Try this:
Code:
adb push 2013-08-07.23.11.28 /mnt/shell/emulated/clockworkmod/backup/2013-08-07.23.11.28/
That'll push the contents of folder 2013-08-07.23.11.28 under platform-tools and put them in a folder called 2013-08-07.23.11.28 under /backup/. If it doesn't exist, it'll create the folder. Now you pulled the backups by using /sdcard/, I didn't know you could just do that, so I guess you could try pushing using that too:
Code:
adb push 2013-08-07.23.11.28 /sdcard/clockworkmod/backup/2013-08-07.23.11.28/
I'm pretty sure those should do the trick. Let me know if that helped.
Johmama said:
A quick guide to the adb pull and adb push commands:
Code:
adb pull <remote> <local>
adb push <local> <remote>
Remote being folder location on phone, local being folder location on computer.
So the correct command to pull the backup and put it into a folder under platform-tools (let's use the folder name you are using) would be this:
Code:
adb pull /sdcard/clockworkmod/backup/2013-08-07.23.11.28/ 2013-08-07.23.11.28
All you have to do to put it into it's own folder is put a space after the remote location and type whatever name you want the folder to be.
Now on to your current question. You said you pulled the files onto the computer, but they weren't in their own folder. I would put them into their own folder (we'll use 2013-08-07.23.11.28 for now) and push the contents of that folder to a folder on your phone, that we will also call 2013-08-07.23.11.28 under the backup location (If you want to make sure you have only the files contained in the backup, try re-pulling them using the above pull command. If you're pretty sure you know which ones it pulled, I wouldn't worry about it). Try this:
Code:
adb push 2013-08-07.23.11.28 /mnt/shell/emulated/clockworkmod/backup/2013-08-07.23.11.28/
That'll push the contents of folder 2013-08-07.23.11.28 under platform-tools and put them in a folder called 2013-08-07.23.11.28 under /backup/. If it doesn't exist, it'll create the folder. Now you pulled the backups by using /sdcard/, I didn't know you could just do that, so I guess you could try pushing using that too:
Code:
adb push 2013-08-07.23.11.28 /sdcard/clockworkmod/backup/2013-08-07.23.11.28/
I'm pretty sure those should do the trick. Let me know if that helped.
Click to expand...
Click to collapse
thanks a ton. it worked. i tried the first option. rebooted recovery. and it could not find the files. i rebooted the phone. and then went back into recovery. the files still were not there.
so then i did the second option. with the sdcard. it worked like a charm. his phone is back to aug 7th. and didnt lose a thing... other than the last four days of his new data.
phermey said:
thanks a ton. it worked. i tried the first option. rebooted recovery. and it could not find the files. i rebooted the phone. and then went back into recovery. the files still were not there.
so then i did the second option. with the sdcard. it worked like a charm. his phone is back to aug 7th. and didnt lose a thing... other than the last four days of his new data.
Click to expand...
Click to collapse
Well that's odd, I'm the exact opposite, I can't see the files in /sdcard/, only the path through /mnt/. I'm not too familiar with how the Nexus 4 handles the emulated sdcard, I just never had the reason to explore it.
Actually, I think the difference between where our recoveries saw the backups is because of a version difference. CWM has changed their backup location in the past, and I'm sure you are using a version that is looking for backups in the /sdcard/ directory, while mine was looking for them through /mnt/.
EDIT:
Oh btw, you might advise your friend to download a file explorer app (I use ES File Explorer) and erase those backups that he didn't use in the /mnt/ folder. I'm sure they are still there taking up space on his phone. You may or may not need root to see the correct folder though.

[Q] ADB pull problem on linux

Hi All,
I am in the process of trying to root and install a custom rom on my Nexus 4 4.4.2. I am a new linux user (Linux Mint 16) and my rooting experience is limited. When I try to do an "abd pull /sdcard/ /sdcard/" this is what it says
adb pull /sdcard/ /sdcard/
pull: building file list...
pull: /sdcard/Android/data/com.google.android.gallery3d/cache/imgcache.1 -> /sdcard/Android/data/com.google.android.gallery3d/cache/imgcache.1
cannot create '/sdcard/Android/data/com.google.android.gallery3d/cache/imgcache.1': No such file or directory
I was able to successfully do an abd backup...
USB debugging is enabled.
I get the same error whether the phone is connected as a Media device (MTP) or Camera (PTP).
any reason why the pull command wont work?
Any help is appreciated!
smokewagon said:
Hi All,
I am in the process of trying to root and install a custom rom on my Nexus 4 4.4.2. I am a new linux user (Linux Mint 16) and my rooting experience is limited. When I try to do an "abd pull /sdcard/ /sdcard/" this is what it says
adb pull /sdcard/ /sdcard/
pull: building file list...
pull: /sdcard/Android/data/com.google.android.gallery3d/cache/imgcache.1 -> /sdcard/Android/data/com.google.android.gallery3d/cache/imgcache.1
cannot create '/sdcard/Android/data/com.google.android.gallery3d/cache/imgcache.1': No such file or directory
I was able to successfully do an abd backup...
USB debugging is enabled.
I get the same error whether the phone is connected as a Media device (MTP) or Camera (PTP).
any reason why the pull command wont work?
Any help is appreciated!
Click to expand...
Click to collapse
Maybe this will help?
http://www.herongyang.com/Android/adb-push-and-pull-Command.html
Not a big fan of the CLI.
Sent from my Nexus 7 (2013)
Your problem (almost certainly) is that you don't have a /sdcard directory (folder) on your computer unless you created one (there certainly is no default /sdcard in a linux desktop system).
I also don't know how you installed ADB on your computer.
(This should work, otherwise I'll have to change what I wrote below).
Try this:
$ cd ~/Desktop
(This changes you to your desktop directory, if you are not already there)
$ mkdir sdcard
(this will make a new directory called "sdcard" on your desktop, you should see it pop up on your desktop)
$ adb pull /sdcard/ ~/Desktop/sdcard
(should pull the contents of /sdcard from your phone and put them in your newly created directory on your desktop: ~/Desktop/sdcard)
BAM
A little extra basic info for you, and welcome to linux. Soon you have the power to take over the world (ha ha ha... no, actually I'm not kidding at all).
As a basic rule, you should pretty much always be working inside of your home directory, for dealing with your personal files. Your home directory is /home/yourname. On my computers, my home is /home/kirk. My wife's home directory is /home/amy.
"~" is a shortcut for the home directory, for whomever is logged in at that moment.
If you wanted something that is on your desktop, it would be in the directory: /home/yourname/Desktop (~/Desktop). If you wanted to use your documents directory, it is : /home/yourname/Documents(~/Documents).
/home/yourname is where you usually where want to do your stuff.
"/" is the very root directory of the whole system, so you would be better off not creating and doing things like making directories like "/sdcard". That's a bad move. Leave root for system files. Not that you are necessarily going to destroy something by creating a /sdcard directory. But it'll cause you a few hassles.
So, use /home/yourname/sdcard (~/sdcard). Or if you want it on your desktop, (like I did above) use /home/yourname/Desktop/sdcard (~/Desktop/sdcard). Doing things inside of /home/yourname(~) means that you are the owner of that folder and everything in it, not root.
Otherwise you will just be causing headaches for yourself and having to grant yourself root permissions to work with those files (hassle). There's no good reason to do that to yourself. And if you did give yourself root permissions, and screwed up other stuff in the root directory like in: /etc or /dev or /bin, then you will REALLY be irritated.
Stick to your home for your personal files. /home/yourname (~)
Leave "/" or the "root" directory for system files.
You could check my little bash program for adb for Linux too. It's a program to be used in the terminal and it'll pull data off the sdcard etc. You can find it here
Sent from my Nexus 4 running Android 4.4
Thank you all for the help, I'll let you know how it goes.
Do I need drivers for my nexus 4 to work with Linux?
Sent from my Nexus 4 using Tapatalk
smokewagon said:
Thank you all for the help, I'll let you know how it goes.
Do I need drivers for my nexus 4 to work with Linux?
Sent from my Nexus 4 using Tapatalk
Click to expand...
Click to collapse
Try it without any installation of drivers just install adb tools and try the command line or my little tool. If it's not working, check the guides how to set up the usb-rules for adb
Sent from my Nexus 4 running Android 4.4
Thanks, will do.
Sent from my Nexus 4 using Tapatalk
iowabeakster said:
Try this:
$ cd ~/Desktop
(This changes you to your desktop directory, if you are not already there)
$ mkdir sdcard
(this will make a new directory called "sdcard" on your desktop, you should see it pop up on your desktop)
$ adb pull /sdcard/ ~/Desktop/sdcard
(should pull the contents of /sdcard from your phone and put them in your newly created directory on your desktop: ~/Desktop/sdcard)
BAM
Click to expand...
Click to collapse
BAM INDEED! It worked! I am pulling the contents now. Thanks a ton, and thanks for the other basic linux info, I will put it to good use.
Any other tips on using Linux to root android?
Shooooot....
So after the pull command finished, i opened the sdcard directory I created on my desktop, and it was empty....the pull command said this when it was done...
1733 files pulled. 0 files skipped.
2129 KB/s (995292697 bytes in 456.480s)
Any ideas?
Ok, I played with some settings and got it to work, though I don't know why it worked.
USB Debugged is enabled.
The first time I tried to 'pull' i had my USB computer connection set to "Camera (PTP)" - it didn't work.
I tried again changing the USB computer connection to "Media device (MTP)" - it didn't work.
I changed it back to "Camera (PTP)" and my computer recognized it in a different way than the first time (a dialog box popped up asking me what I wanted to do with the pictures that were on the device I had connected, this didn't happen the first time).
I am glad the pull command finally worked, I just wish I knew why.
I guess it's a tough road being a linux NOOB and a (near) Android NOOB. It's good to learn something new and keep my brain young.

Categories

Resources