0

I'd like to be able to issue:

adb pull storage/self/primary/Documents/*20220204* .

Right now doing that gives:

zsh: no matches found: storage/self/primary/Documents/*20220204*
2
  • 1
    You could emulate ADB pull using tar on device side, pipe everything using ADB exec-out to the PC and there untar the received stream. Would be pretty complex but would allow wildcards as it uses tar.
    – Robert
    Feb 4 at 23:23
  • 1
    Possibly related/dupe: Why the file path the phone tells me, I couldn't find in adb shell? (ignore the title since it's actually asking about adb shell and adb pull)
    – Andrew T.
    Feb 5 at 4:39

1 Answer 1

0

The matching of * wildcards is failing, because it's being done by zsh on your computer, which can't see your Android device's filesystem. It's looking for storage/self/primary/Documents/*20220204* in your computer's filesystem, and not finding it. It's fortunate that it doesn't exist on your computer, since if it did, it could only provide a source of confusion.

Here's a way to do the job with tar, using the /data/local/tmp directory, which you can write to from the adb shell on any Android device.

Create some example data

adb shell "cd /data/local/tmp; echo FileA > a.tmp; echo FileB > b.tmp"

We've created a.tmp and b.tmp in /data/local/tmp on the device.

Collect the data into an archive file

adb shell "cd /data/local/tmp ; tar cvfz archive.tar.gz /data/local/tmp/*.tmp"

The first use of /data/local/tmp is getting to the place where you'll create the archive; the second one is the location of the files you want to put into your archive.

Get the archive out of the Android device onto your Linux machine (or is it macOS?)

adb pull /data/local/tmp/archive.tar.gz .

Extract the archive into your current directory

tar xvf archive.tar.gz

Delete the archive off the Android device

adb shell "rm /data/local/tmp/archive.tar.gz"

You must log in to answer this question.

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