Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Powershell: passing a wildcard as a filename to an external command

I am trying to use the ‘adb’ binary to copy a bunch of files from an Android device – all from a PowerShell prompt running under Windows 11.

The Android device contains a bunch of files in its removable media ( ‘/sdcard/’ ):

.\adb.exe ls /sdcard/
000045f8 00002000 65e1f6f0 .
000045f8 00001000 65d5165c ..
000081b0 00006374 65e1f65e a.json
000081b0 00003234 65e1f660 b.json
000081b0 00003adf 65e1f662 c.json
000081b0 000048de 65e1f664 d.json
000081b0 00003f5d 65e1f66d e.json
(...) 

Copying one of them is not a problem:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

.\adb.exe pull /sdcard/a.json
/sdcard/a.json: 1 file pulled, 0 skipped. 1.6 MB/s (11118 bytes in 0.006s)

How do I copy all of them in one go though? (there are hundreds) This:

.\adb.exe pull /sdcard/*.json
adb: error: failed to stat remote object '/sdcard/*.json': No such file or directory

doesn’t seem to work.

I am able to do this from MacOS and Linux – by passing the wildcard just like in the command above. Windows 11 however?

>Solution :

Partial answer.

ADB does not interpret the ‘*’ the way you think it does.

.\adb.exe pull /sdcard/.

I do not know of a way to copy just .json files.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading