Pulling libraries off Android phones

Well, have you ever wanted to pull a bunch of libraries off an Android phone? I bet you wish you could execute the command like this:

> adb pull /system/lib/*.so

Sorry. A no go. What about this then:

> for file in `adb ls /system/lib/`; do adb pull /system/lib/$file; done

Well, almost, but adb ls attaches the \n\r to the files. That wouldn’t be a problem if adb pull didn’t attach them to the names, so you have to get rid of the white space. This can work:

> for file in `adb ls /system/lib`; do adb pull `echo /system/lib/$file | tr -d '\n\r'`; done

Yea. Enjoy.

This entry was posted in Programming and tagged , , , . Bookmark the permalink.