I think adb's push is file-based. I want to be able to push entire folders. Is there an easy way without scripting?
Thanks!
Edit: I need to work with sub-folders.
Edit: Seems that adb pull is recursive but push is not. So I changed the title and description accordingly.
adb pull, pulls all the files in the specified directory:
or
It has been a few years, the issues may or may not have changed, but it is still a PITA. What is working for me on linux is to create a temp folder, create a symlink to the folder(s) I want to copy, and then I adb push. It ignores the main dir, but copies the subdirs. Currently, I'm not needing to create any subdirs, they do get created and copied for me. That might be platform specific, I'm not sure. But the main dir I'm copying, it copies the files in it instead of the dir. So the temp dir gets ignored, and the symlinked folders then get copied. Example:
mkdir tmp cd tmp ln -s ../Foo . ln -s ../Bar . cd .. adb push tmp /sdcard/
And it will push Foo/file1 to /sdcard/Foo/file1 With just adb push Foo/. /sdcard/ then I end up with /sdcard/file1 which doesn't make me happy.How about: archive -> push -> extract
Ran into this as well and found this article useful, but may have found a more complete solution. Running the following from the folder containing the files/folders you want to push:
adb push . /myDestinationFolder
The key is the prefix '/' before the destination folder apparently. This works from my windows command prompt, but when I run it from git bash (on Windows) I get some errors due to the meaning of the '/' in a path within the bash shell. So this might not work from linux/bash, however it definitely copied all subfolders for me.
To expand on
autra
's genius answer a bit, I made a quick script to automate this (for Linux/Mac only).I created an empty file in my home directory called
adb-push
. Then I edited the file with a text editor (like gedit, nano, vim, etc.) and put the following contents into it:Then I made it executable:
This is how I run it:
For example, if I want to send "~/backups/DCIM" to my device's sdcard folder, I would do this:
(But keep in mind that the location of the sdcard is not "/sdcard" for every Android device. For instance, it might be "/mnt/sdcard" instead.)