6

How do I copy a folder from my android device to a certain folder of my computer?

if I use this command:

adb pull efs

It copies the contents of the efs folder to my computers root directory. I want to copy the whole folder with it contents to a certain destination to my computer.

I have tried with the following for instance, without success

adb pull efs C:\Users

(my android is rooted)

I am using a window shell

1

2 Answers 2

0

To pull files to the C:\Users directory with adb you would need to be in an elevated command prompt. If it is not a necessity to have it in the C:\Users directory, you could pull the files elsewhere. Ex: adb pull C:\Users\[your username]\Desktop.

9
  • 1
    What about Linux then? That ADB command OP noted doesn't seem to work in a Linux distro too.
    – Firelord
    Sep 7, 2015 at 19:39
  • To pull files to a directory in Linux with adb you would use the same syntax. Ex: adb pull /path/to/files /home/[your username]/ Although if you were not root you would not be able to pull the files to any directory.
    – Dominic
    Sep 7, 2015 at 19:52
  • It's not working. I tried it already. Also, I'm asking about pulling the directory itself, not just the files inside it which your comment seems to be doing.
    – Firelord
    Sep 7, 2015 at 19:59
  • 1
    To have the two scripts be copied into a folder on your computer named Testing you can add the directory name to the end of the destination. adb pull /sdcard/Testing/ ~/Testing/
    – Dominic
    Sep 7, 2015 at 20:48
  • 1
    That's the point I'm trying to make. It does not get created automatically.
    – Firelord
    Sep 7, 2015 at 20:51
0

I can do it, without difficulty or elevated command prompts. This does require reasonable familiarity with the Windows Command Prompt shell commands. If you're trying to use commands as scripts without understanding them, you'll have trouble with this.

I start with a directory c:\android with two subdirectories c:\android\bin where I have put adb and the rest of the platform tools, and c:\android\pushpull for test data.

Set up PATH

c:\> PATH c:\android\bin;%PATH%

Create some test data

c:\> cd c:\android\pushpull
c:\android\pushpull> mkdir test
c:\android\pushpull> cd test
c:\android\pushpull\test> echo foo > foo.txt
c:\android\pushpull\test> echo bar > bar.txt
c:\android\pushpull> cd ..

Push it to the test area on the device

c:\android\pushpull> adb push test /data/local/tmp

Look on the device to check it's there:

c:\> adb shell
$ cd /data/local/tmp
$ ls -R
.:
test

./test:
bar.txt  foo.txt
$ cat test/foo.txt
foo
$ cat test/bar.txt
bar
$ exit

Remove the Windows version of the test directory

c:\android\pushpull> rmdir /s /q test

Check it has gone

C:\android\pushpull>dir 
 Volume in drive C is Local Disk
 Volume Serial Number is REDACTED
 
 Directory of C:\android\pushpull
 
25/06/2023  14:25    <DIR>          .
08/06/2023  20:25    <DIR>          ..

     Total Files Listed:
               0 File(s)             0 bytes
               2 Dir(s)  REDACTED bytes free

Pull the Android copy back to the Windows machine

c:\android\pushpull> adb pull /data/local/tmp/test .

The second argument to adb pull, which is just a ".", is the necessary detail.

Check the copy

C:\android\pushpull>dir /s test
 Volume in drive C is Local Disk
 Volume Serial Number is REDACTED
 
 Directory of C:\android\pushpull\test
 
25/06/2023  14:25    <DIR>          .
25/06/2023  14:25    <DIR>          ..
25/06/2023  14:25                 6 bar.txt
25/06/2023  14:25                 6 foo.txt
               2 File(s)             12 bytes

     Total Files Listed:
               2 File(s)             12 bytes
               2 Dir(s)  REDACTED bytes free

Notes

The key detail is realising that adb is a UNIX-heritage program, and really prefers you to specify where the files you'll pulling (or pushing) are to go. Trying to default this doesn't work well. Google do their Android development on Linux, and tend to assume that if you're using adb at the command line you have some experience with shells and Linux.

Software versions

Windows 11 22H2, Android 13, Android Debug Bridge version 1.0.41 from Platform Tools version 34.0.3-10161052.

You must log in to answer this question.

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