ADB反复拉动(ADB pull iteratively)

标题可能措辞不佳,但基本上我的朋友的Galaxy S6在启动约30秒后由于错误而不断重启: System UI has stopped working

我试图恢复目录/mnt/sdcard/DCIM/包含的所有图片,但在使用adb pull /mnt/sdcard/DCIM/复制了其中的80个图片后,手机重新启动。 我怎样才能一次复制80个,然后睡20秒,然后拉下80个?

The title is probably poorly worded, but essentially my friend's Galaxy S6 keeps restarting after being started up for about 30 seconds due to the error: System UI has stopped working

I'm trying to recover all of the pictures contained within the directory /mnt/sdcard/DCIM/ but the phone restarts after I copy around 80 of them using adb pull /mnt/sdcard/DCIM/. How can I copy 80 at a time and then sleep for say 20 seconds, and pull the next 80?

最满意答案

我最终得到的解决方案是这样的:

获取所述目录中的所有文件的列表,然后遍历其中的一些文件,如果由于设备重新启动而导致复制失败,则等待一秒钟并重试。 如果文件已被复制,请跳过该文件。

$outputDirectory = "C:\Temp\RecoveredPictures" $amount = 100 adb shell find /mnt/sdcard/DCIM/Camera -type f > C:\Temp\PictureNames.txt $files = Get-Content C:\Temp\PictureNames.txt for ($i = 0; $i -lt $files.Length; $i++) { $file = $files[$i] $fileName = $file.Split("/")[-1] if (Test-Path $outputDirectory\$fileName) { continue } Write-Host "File name is $file" adb pull $file $outputDirectory\$fileName if ($error[0].ToString() -like "error: device '(null)' not found") { $i-- sleep 1 } }

The solution I ended up coming with was this:

Get a list of all the files in said directory, then iterate through a number of them, if the copying fails due to the device restarting, then wait a second and try again. If the file is already copied, skip that file.

$outputDirectory = "C:\Temp\RecoveredPictures" $amount = 100 adb shell find /mnt/sdcard/DCIM/Camera -type f > C:\Temp\PictureNames.txt $files = Get-Content C:\Temp\PictureNames.txt for ($i = 0; $i -lt $files.Length; $i++) { $file = $files[$i] $fileName = $file.Split("/")[-1] if (Test-Path $outputDirectory\$fileName) { continue } Write-Host "File name is $file" adb pull $file $outputDirectory\$fileName if ($error[0].ToString() -like "error: device '(null)' not found") { $i-- sleep 1 } }

更多推荐