5

I have a Samsung Galaxy Tab 2 (actually, many of them) and I need to regularly push some files inside the external physically removable SD card of my tablets.

Android handles internal and external storage as follows:

/storage
  ├ emulated/0/ /* this is the internal storage partition */
  └ 9102-ABF4 /* this is the external removable SD card partition */

I thought I could find this path by browsing to the folder which is not named /emulated inside /storage since the other one is the one I want.

I want, using device's shell through adb, to navigate to (using command cd) a directory that I don't know the path of (9102-ABF4 written above, located inside /storage/)

5
  • what is your question? cd /storage/????-?????
    – alecxs
    Aug 14, 2019 at 10:44
  • @alecxs I want, using device's shell through adb, go (using command cd) inside a directory that I don't know (9102-ABF4 written above, located inside /storage)
    – puffo
    Aug 14, 2019 at 10:48
  • 1
    @puffo The command alecxs presented to you does exactly what you want to do: cd into a directory the name you don't know (but you know the pattern of the directory name). Just try it out.
    – Robert
    Aug 14, 2019 at 17:33
  • 1
    @alecxs You should make an answer from your comment. Using wildcards with cd is a nice trick especially as it should work perfectly for all sd-cards as the pattern is always the same.
    – Robert
    Aug 15, 2019 at 12:55
  • @Robert i am afraid the question is off-topic so i won't answer - besides this it's not worth it because that are basics in shell coding ;)
    – alecxs
    Aug 15, 2019 at 13:02

2 Answers 2

2

If your Android is 6 or above, and if your are connected through USB cable and your Android have USB debugging enabled, and if you have installed:

sudo apt install adb perl

put in a Linux terminal:

adb shell sm list-volumes public | perl -lane 'print $F[-1]')

This will show the micro SD card identification, example:

9102-ABF4

I made several scripts to automate send and receive files from Linux to Android and from Android to Linux:

https://github.com/wachin/adb-send-files

1

I don't believe adb shell supports tab completion. It makes reference to a directory in a command, but if you don't know the path you will need to use adb shell ls command to list the directory before using the path in an adb push command. For example, adb shell ls storage/9102-ABF4 will let you explore the external SD card that is on your device.

In terms of changing the working directory on your terminal, I don't believe you can do this because adb does not support interactive mode like nslookup. You are using a shell (adb shell) within a shell (bash, PowerShell, cmd, etc).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .