Search code examples
androidadbcommand-promptandroid-permissions

How to read a text file from SD card in Android device through command prompt?


There is a folder called "D_Permision" SD Card and there is a text file called "permission.txt" in it.

I want to read this text file through command prompt and display its content in the command prompt(Not in a separate file)

When I use

adb pull permission.txt /sdcard/D_Permission

it gives following error

remote object 'permission.txt' does not exist.

but I used

adb push permission.txt /sdcard/D_Permission  

(successfully added permission.txt to D_Permission folder)

and the tried to pull.but I get same error.

sdcard/D_permission has both read / write permission

So how to read this text file through command prompt and display its content in the cmd?


Solution

  • You don't need to pull the file. adb provides shell acces, so you can do a cat:

    adb shell cat /sdcard/D_Permission/foo.txt
    

    If the file does not exist though, you'll still get "does not exists" error of course, which is normal.