• adb push与adb pull


    简介

        做android相关的工作基本都会用到adb,简单介绍下adb pull与adb push

    从手机导出文件

    adb pull <remote> <local> :Copies a specified file from an emulator/device instance to your development computer.

    向手机导入文件

    adb push <local> <remote>:Copies a specified file from your development computer to an emulator/device instance.

    在命令行调用,首先要切到adb目录,然后就可以直接调用adb push和adb pull命令了

    列子:

    导入文件:adb push D:\test.apk /sdcard/tmp

    导出文件:adb pull /sdcard/tmp/test.apk D:\

    提示:在导入或者导出多个文件时,要先把文件都放到一个文件夹中,以文件夹的方式导入导出。

    如果对手机下的没有访问权限,就不能导出。

    模拟器默认赋予用户root权限

    给一个上传文件的shell

    Create pullFiles.sh:

    #!/bin/bash
    HOST_DIR=<pull-to>
    DEVICE_DIR=/sdcard/<pull-from>
    EXTENSION=".jpg"
    
    for file in $(adb shell ls $DEVICE_DIR | grep $EXTENSION$)
    do
        file=$(echo -e $file | tr -d "\r\n"); # EOL fix
        adb pull $DEVICE_DIR/$file $HOST_DIR/$file;
    done

    Run it:

    Make it executable: chmod +x pullFiles.sh

    Run it: ./pullFiles.sh

    Notes:

    • as is, won't work when filenames have spaces
    • includes a fix for end-of-line (EOL) on Android, which is a "\r\n"
  • 相关阅读:
    memset
    无穷大无穷小的表示方法
    堆-STL
    3386 二分图 洛谷luogu [模版]
    jquery——幻灯片(只动一屏)
    jquery——整屏滚动
    jquery——元素节点操作
    jquery——事件冒泡、事件委托
    jquery——解决鼠标移入移出导致盒子不停移动的bug
    jquery——无缝滚动
  • 原文地址:https://www.cnblogs.com/cocoabird/p/6101950.html
Copyright © 2020-2023  润新知