文章目录 adb file transfer使用文档 adb命令行进行文件传输注意事项adb push🎈路径名约定 push文件保持名字直接传输传输的同时更改名字
包括三个子命令:
比较常用的是前面
使用adb push
可以用来向anroid设备传输文件
另一方面,adb pull
可以从Android 设备将文件拉取到电脑上
push
push [--sync] [-z ALGoRITHM] [-Z] LOCAL... REMOTE copy local files/directories to device --sync: only push files that are newer on the host than the device -n: dry run: push files to device without storing to the filesystem -z: enable compression with a specified algorithm (any/none/brotli/lz4/zstd) -Z: disable compression
pull
pull [-a] [-z ALGORITHM] [-Z] REMOTE... LOCAL copy files/dirs from device -a: preserve file timestamp and mode -z: enable compression with a specified algorithm (any/none/brotli/lz4/zstd) -Z: disable compression
sync
sync [-l] [-z ALGORITHM] [-Z] [all|data|odm|oem|product|system|system_ext|vendor] sync a local build from $ANDROID_PRODUCT_OUT to the device (default all) -n: dry run: push files to device without storing to the filesystem -l: list files that would be copied, but don't copy them -z: enable compression with a specified algorithm (any/none/brotli/lz4/zstd) -Z: disable compression
adb push
(推送电脑文件到手机)为例 adb pull
拉取手机文件到电脑)遵循类似的规则,但是参数位置不同fileName
adb push fileName /sdcard/
(传输完成后,android设备的/sdcard/
目录下将出现文件fileNmaeadb push fileName /sdcard/Download/fileNewName.ext
/sdcard/Download/
,出现的新文件名为你指定的名字fileNewName.ext
同时,如果手机上没有中间路径,那么adb的此次传输会创建相应中间路径
PS C:\Users\cxxu\Desktop> touch aPS C:\Users\cxxu\Desktop> push a /sdcard/d1/d2/d3/a2ba: 1 file pushed, 0 skipped.PS C:\Users\cxxu\Desktop> adb shellxaga:/$ ls -l /sdcard/d1/d2/d3/a2b-rw-rw---- 1 u0_a214 media_rw 0 2022-11-19 14:21 /sdcard/d1/d2/d3/a2b
adb push file /sdcard/NotYetExistDir/
(报错) /
结尾表示传输的目标目录非法的路径参数
$downloadM="/scard/Download"function pushToAndroid{ param ( $path, $DestinationPath_opt = "$downloadM" ) adb push $path $DestinationPath_opt}set-alias push pushToAndroid
用例:push fileNameOrDirName
PS C:\Users\cxxu\Desktop\videos> push .\test.\test: 1 file pushed, 0 skipped.
这里我将一个压缩包传输到手机上
这里要注意,第二个路径参数的斜杠是linux规范的/
,如果写成\
会导致意外的结果(文件传输到意料之外的地方,找不到了)
对于目录,即为可以不加斜杠,但是推荐加上,这样一目了然
PS C:\Users\cxxu\Downloads> adb push C:\Users\cxxu\downloads\Compressed\MK90.0-santoni-210620-HISTORY.zip /sdcard/DownloadC:\Users\cxxu\downloads\Compressed\MK90.0-santoni-21062...shed, 0 skipped. 25.2 MB/s (695991497 bytes in 26.315s)PS C:\Users\cxxu\Downloads>
PS C:\Users\cxxu\Downloads\Compressed> adb push .\lineage-18.1-20220720-UNOFFICIAL-0xCAFEBABE-Mi8937.zip /sdcard/Download/.\lineage-18.1-20220720-UNOFFICIAL-0xCAFEBAB...pped. 23.7 MB/s (783898135 bytes in 31.594s)PS C:\Users\cxxu\Downloads\Compressed>
可选操作:检查android指定目录下是否存在某文件(下面是已经root的才有权限)
santoni:/ # cd sdcard/santoni:/sdcard # lsAlarms MIUI Music Ringtones baidu did sogouAndroid MT2 Notifications TWRP browser jeejen wlan_logsDCIM MiMarket Pictures Xiaomi com.miui.voiceassist miadDownload Movies Podcasts backups dctp mipushsantoni:/sdcard # cd Download/santoni:/sdcard/Download # ls3b515ef2c77d9f04e58c1d75a3add549-0-o_1g8cle2dk1mia12ds1vjs13eost32c-uid-408649.apkDevCheck_4.37.apkGitHub\ -\ yc9559_uperf_\ Userspace\ perfORMance\ controller\ for\ android.mhtmlMK90.0-santoni-210620-HISTORY.zipapp-releas.zipapp-release.apkapp-release_mini.apkboot.imgboots.zipmaGISk_patched-25200_VBQAh.imgmiui_HM4X_V11.0.1.0.NAMCNXM_7e7448fe6d_7.1.zipuperf-dev-22.07.24.zip
来源地址:https://blog.csdn.net/xuchaoxin1375/article/details/127936859
--结束END--
本文标题: adb_adb file transfer文件传输(adb push/pull)
本文链接: https://lsjlt.com/news/393851.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-01-21
2023-10-28
2023-10-28
2023-10-27
2023-10-27
2023-10-27
2023-10-27
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0