Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to push folders from computer into sdcard using adb shell

Tags:

android

shell

adb

If I have a folder structure in my computer such as A\B and the B subfolder contains 5 files, if I issue the command

adb push c:\programs\A\*.* /sdcard/fooBar  

it copies all the 5 files inside the B subfolder into /sdcard/fooBar
How do I copy the entire subfolder B into the android device so that the fodler structure inside the device looks like /sdcard/fooBar/B/5-files?

like image 600
user13267 Avatar asked Oct 22 '13 03:10

user13267


3 Answers

Don't use \*.* may be ok

adb push c:\programs\A\ /sdcard/fooBar/
like image 92
Yhzhtk Avatar answered Nov 13 '22 21:11

Yhzhtk


adb push c:\programs\A\B /sdcard/fooBar/B
like image 9
Da Ha Song Avatar answered Nov 13 '22 21:11

Da Ha Song


I've struggled with this question myself and it is clear that both answers do not actually answer the question.

To adb push to the SD Card, do not use /sdcard; that's your internal storage!

To push to your SD Card, first, you need to drop to adb shell in order to find it.

❯ adb shell
phoenix_sprout:/ $ 

Once in the shell, let's find it.

phoenix_sprout:/ $ cd storage
phoenix_sprout:/storage $ ls
C1ED-8A74  emulated  self

On that phone, the SD Card is at /storage/C1ED-8A74.

phoenix_sprout:/storage $ cd C1ED-8A74/                                                            
phoenix_sprout:/storage/C1ED-8A74 $ ls
Alarms   Audiobooks  Documents  Movies  Notifications  Podcasts   UI
Android  DCIM        Download   Music   Pictures       Ringtones

You can verify that this is the SD Card by checking the folder's content and matching it with what's on your phone's file manager.

Now you can exit from the adb shell and push stuff.

adb push A /storage/C1ED-8A74/

Congrats! You've now got A and its subfolders in your SD Card.

like image 1
Nato Boram Avatar answered Nov 13 '22 20:11

Nato Boram