需求
本地电脑有文件 C:\Users\CoderLct\Desktop\dataDir\1.txt,需要把dataDir整个文件夹复制到android系统/storage/files下。
方法
1、拷贝整个文件夹
adb push C:\Users\CoderLct\Desktop\dataDir /storage/files
2、拷贝文件夹下的内容
adb push C:\Users\CoderLct\Desktop\dataDir\. /storage/files
注意
当android已存在/storage/files时
方法1执行结果:/storage/files/dataDir/1.txt。
方法2执行结果:/storage/files/1.txt。
当android不存在/storage/files时
方法1执行结果:/storage/files/1.txt。
方法2执行结果:/storage/files/1.txt。
解决在android不存在/storage/files时,达到复制整个文件夹的效果,如下:
adb push C:\Users\CoderLct\Desktop\dataDir\. /storage/files/dataDir