Only read this if you know how to work with ADB (and where to get it, etc.)^^
Something like this could work (and should be reliable)...
Ofc USB-Debugging must be on on your phone (developer options must have been activated for this!) and it must be connected via USB.
Eventually a driver is necessary to install as well (look at the device manager!)
No transfer mode is necessary (ADB doesn't need it) but make sure that in the developer options things like:
USB debugging (Security settings)
Disable adb authorization timeout
are active if they exist
Ofc you should have adb on your computer and to fill the correct values for
$adbTool: Find the correct path for it on your computer
$adbPattern:
Open a command prompt, cd into your adb folder, execute:
Look at the output, if your device is listed, get something from that line and fill the variable with it
$srcPicPath:
Open a command prompt, cd into your adb folder, execute:
Code: Select all
adb shell
And if in the shell
navigate to your camera folder via: cd
Finally change your
$dstPath variable...
Code: Select all
$adbTool = "D:\Tools\@CLI Tools\ADB\adb.exe";
$adbPattern = "device"; // Must exist in output of "adb devices"
$srcPicPath = "/sdcard/DCIM/Camera"; // On your Android phone, case-sensitive!
$dstPath = "D:\Users\%USERNAME%\Pictures"; // Default destination path
// ========================================================================
// == DO NOT CHANGE ANYTHING BELOW IF YOU DO NOT KNOW WHAT YOU ARE DOING ==
// ========================================================================
$srcFiles = get("SelectedItemsNames");
$failedLog = "%TEMP%\~xyplorer_adb_move_pictures_FAILED.txt";
end (exists($adbTool) != 1), quote($adbTool) . <crlf 2> . "does not exist, aborted!";
end (!$srcFiles), "No item(s) selected, aborted!";
// ADB tests
status "Preparing ADB", , "progress";
$result = runret(lax("$adbTool" kill-server), "%TEMP%");
$result = runret(lax("$adbTool" start-server), "%TEMP%");
$result = runret(lax("$adbTool" devices), "%TEMP%");
// List of devices attached
// a8bcd8ea device
if (strpos($result, $adbPattern) == -1) {
echo "Android device not listed, aborted!";
$result = runret(lax("$adbTool" kill-server), "%TEMP%");
end true;
}
// Prepare log
$result = writefile($failedLog, "", , "utf8");
setting "BackgroundFileOps", 0;
$batFile = "%TEMP%\~xyplorer_adb_move_pictures.bat";
$batContent = "@ECHO OFF" . <crlf 2>;
foreach($srcFile, $srcFiles, <crlf>, "e") {
$content = <<<>>>
ECHO Moving "$srcFile"...
"$adbTool" pull "$srcPicPath/$srcFile" "$dstPath\$srcFile"
IF EXIST "$dstPath\$srcFile" (
"$adbTool" shell rm "$srcPicPath/$srcFile"
) ELSE (
ECHO Failed to transfer: "$srcFile">>$failedLog
)
>>>;
$batContent .= $content . <crlf>;
}
writefile($batFile, $batContent, , "utf8");
run lax("cmd" /c "$batFile"), "%TEMP%", 1, 1;
$result = readfile($failedLog, , , 65001);
#485;
if ($result) {
text $result;
}
$result = runret(lax("$adbTool" kill-server), "%TEMP%");
TRY IT WITH TEST IMAGES ON YOUR PHONE FIRST, I'M NOT RESPONSIBLE FOR ANY DATA LOSS:
Navigate to your pictures in your
Camera folder on Android via XYplorer, select the pictures you want to move and then run the script...
If something doesn't work, provide as much detailed info as necessary, It's not my phone on your computer^^
And if this works for someone, change the file dates to that of the image you've copied at the end of the script (too lazy to do this, I'm on the Apple eco system, no interest in Android any more)...