android: Recursive copy with adb push
I'm gonna dig this even more to give a full solution to this (for linux only), because google redirect to this and I had this exact same problem.
With a simple adb push, the problem is that all the subdirectories must exist BEFORE doing the push, which can be very painful to achieve.
Note that an easy solution is to zip the folder, push the zip then unzip on the device. But let's say you don't have unzip on your device (highly unlikely, really).
You want to push a full tree with a lot of subdirectories to your device in an empty directory myDirectory. There are two steps :
First create all the subdirectories, in your source device:
cd <folder-containing-myDirectory>
find myDirectory/ -type d -exec adb shell mkdir <path-to-folder-containing-myDirectory-in-device>/{} \;
This command find all the subdirectories of myDirectory (including ., so if myDirectory already exists, you will have one error message you can safely ignore) and for each of them, create the matching directory on the device.
then push everything
adb push myDirectory/. <path-to-folder>/myDirectory
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.
Try this (worked with subfolders):
adb push mySourceFolder/. myDestAndroidFolder
Empty folders do not copy to android device.
adb pull, pulls all the files in the specified directory:
$ adb pull /mnt/sdcard/
pull: building file list...
pull: /mnt/sdcard/t3.txt -> ./t3.txt
pull: /mnt/sdcard/t2.txt -> ./t2.txt
pull: /mnt/sdcard/t1.txt -> ./t1.txt
3 files pulled. 0 files skipped.
or
$ adb push . /mnt/sdcard/
push: ./t2.txt -> /mnt/sdcard/t2.txt
push: ./t3.txt -> /mnt/sdcard/t3.txt
push: ./t1.txt -> /mnt/sdcard/t1.txt
3 files pushed. 0 files skipped.