Friday, February 16, 2018

How to BackUp from Android to Desktop using ADB via a Context Menu

Pre-Req's:



install sdk, make sure you know how to run adb from cmd prompt.
Run cmd  as Admin:




1. Figure out paths of your internal/external cards


  adb shell ls $EXTERNAL_STORAGE
  adb shell ls $SECONDARY_STORAGE

 2. Test commands to work with external/internal

  cd C:\Work\Tools\Misc\Android\sdk\platform-tools 
// INTERNAL
  adb pull /sdcard/Backups/ C:\Temp\Phone\Media\20180216\Backups
  // EXT SD CARD
  adb pull /storage/D02B-5AB9/backups/ C:\Temp\Phone\Media\20180216\Backups


  3. Create a bat file to backup all folders using those commands


   See Synch.Phone.BackUp.bat below
   Save to C:\temp (or ur own dir)
   Run bat file like so: Synch.Phone.Backup C:\Temp\Phone\20180216



  
  4. Add Reg file so we have a context menu


  




Windows Registry Editor Version 5.00
 
  [HKEY_CLASSES_ROOT\Directory\shell\Synch03_PUSHPhoneHere]
  @="Execute Synch03_PUSHPhoneHere"
 
  [HKEY_CLASSES_ROOT\Directory\shell\Synch03_PUSHPhoneHere\command]
  @="\"C:\\Temp\\Synch.Phone.BackUp.bat\" \"%1\""
  

Bat File    See Synch.Phone.BackUp.bat

*** note your External SD card may b different. Mine is D02B-5AB9



@ECHO OFF
SET dest=%1
setlocal
:PROMPT
SET /P AREYOUSURE=Are you sure U WANT TO %dest% BACKUP TO  (Y/[N])?
IF /I "%AREYOUSURE%" NEQ "Y" GOTO exitMe

 Echo START Synch.Phone.BackUp.bat
 cd %ANDROID_HOME%

 ECHO ****************dest: %dest%
 ECHO ****************START  %DATE% %TIME% synch

 ECHO ****************Current Folder Name: %foldername%

 ECHO ONE way copy phone to BU location
 ECHO synch excluding older file, This should preserve newer copy exist in both locations
 ECHO  ******* Start COPY Internal...

 mkdir %dest%\Backups\Test
 adb pull /sdcard/Backups/Test %dest%\Backups\Test
 mkdir %dest%\Backups
 adb pull /sdcard/Backups %dest%\Backups
 mkdir %dest%\Pictures
 adb pull /sdcard/Pictures %dest%\Pictures


 ECHO  ******* Start COPY External...


 mkdir %dest%\Backups\Test
 adb pull /storage/D02B-5AB9/Backups/Test %dest%\Backups\Test
 mkdir %dest%\Backups
 adb pull /storage/D02B-5AB9/Backups %dest%\Backups


 ECHO ****************DONE  %DATE% %TIME% synch

 cd C:\temp
 pause
:exitMe
 ECHO  ******* exiting...

No comments:

Post a Comment