Advertisement
GlobalAccessSoftware

AAA-Sync.bat

Nov 16th, 2023
572
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 9.15 KB | Software | 0 0
  1.  
  2.  
  3. ::: RC7
  4. :start
  5.   @echo off
  6.   set timethen=%time%
  7.   set datethen=%date%
  8.   if not defined vers set vers=v8.7.0.09 20231106063912 by -JpE-
  9.   set ttl=** Auto Rapid Backup of/by JpE:  LAUNCHED %datethen% @ %timethen% **
  10.   set /a exit2=0
  11.  :: exit2 ^ var for processes to flag an exception or redirection.
  12.   set bats=C:\Users\%username%\Documents\AAA Sync2Laptop\Batch Files\BCS-Suite
  13.  REM set util1="%bats%\utility1.bat"
  14.  
  15.  
  16. :restart
  17.   title  %ttl%
  18.   set mstr=** Master-Program - Maintenance Ultra Deluxe Pro 8 **
  19.   set filename2="%bats%\overrider3.txt"
  20.   set /a override1=0
  21.   if exist %filename2% set /a override1=1 & del /f /s /q %filename2%
  22.  REM echo . & echo override1 == %override1% & echo . & pause & echo . & exit
  23.   if %override1% equ 0 cls
  24.   echo .
  25.   echo .
  26.  ::
  27.  ::::::::::::::::::::::::::::::::::
  28.  :::::::: Global Variables ::::::::
  29.  ::::::::::::::::::::::::::::::::::
  30.  ::
  31.  :: Set Alias for Long Line, Short Line, Docs & LogFile.
  32.   set sl=         /*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\
  33.   set l1=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  34.   set l2=\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  35.  ::
  36.   set dir=C:\Users\%username%\Documents
  37.   cd %dir%
  38.  ::
  39.  rem LOGs could BE DEVELOPED, FOR ALL MODULES.
  40.   set lf="%dir%\AAA-Sync_LogFile.txt"
  41.  :::::::::::::::::::::::::::::::::::::
  42.   set smsg="%bats%\caller_check_showmsg.bat"
  43.   set oldr="%bats%\SyncOlderPhotos.bat"
  44.   set outs="%bats%\outlook_handler.bat"
  45.   set sams="%bats%\phone_backups.bat"
  46.  :: Actual Error Handling Routine (under dev)
  47.   set errr="%bats%\ErrorHandling.bat"
  48.  :: Rev 2 v7.9.2.36 adds: v testfile
  49.   set fileo="%bats%\caller_check.txt"
  50.  ::  ^v these are predefined in SOP also.
  51.   set exidos="%bats%\exit_main.bat"
  52.  :: split out v7.9.4.42 20220921032112
  53.   set copy="%bats%\copy_control.bat"
  54.  :: Test file declaration.
  55.   set test="D:\Copies\My Documents\AAA Sync2Laptop\good1.txt"
  56.  
  57.   set /a backout=0
  58.   set /a samsung=0
  59.   set /a wipe=0
  60.   set /a r3v3rs3=0
  61.   set /a clrphodest=0
  62.   set /a clroutdest=0
  63.   set /a code2=0
  64.  
  65.   echo %sl%
  66.   echo          *** Syncs Key Folders with ALL Copies! ***
  67.   echo %sl%
  68.   echo          **  %vers%   **
  69.   echo %sl%
  70.   echo .
  71.   echo %l1%
  72.   echo       ***   This will backup your Basic folders.   ***
  73.   echo %l1%
  74.  ::
  75.   if exist %fileo% call %smsg%
  76.   if exist %fileo% del /f /s /q %fileo%
  77.  REM echo . & echo override1 == %override1% & echo . & pause & echo .
  78.   if %override1% neq 1 goto input
  79.  
  80.   set /a skiy=1
  81.   set /a backout=1
  82.   set /a clr=1
  83.   set /a out=1
  84.   set /a dest=1
  85.   set /a full=2
  86.   set /a samsung=1
  87.   set /a clrphodest=2
  88.   set /a olde=2
  89.   set /a review=2
  90.   echo .
  91.  REM echo Made it to Here! & pause & echo . & exit
  92.   goto control
  93.  
  94.   :::::::::::::::::::::::::::::::::[ USER INPUT ]:::::::::::::::::::::::
  95. :input
  96.   echo .
  97.   set msg="=*=*=*=>  Is this a Rescue/Recovery Mission? (y/N): "
  98.   choice /c yn /n /t 3 /d n /m %msg%
  99.   if %errorlevel% equ 1 goto recover
  100.   echo . & echo %l1% & echo .
  101.  ::
  102.   echo To make further prompting unneccessary and speed it up
  103.   set msg="===> Shall we skip wipe of all destinations? (Y/n): "
  104.   choice /c yn /n /t 15 /d y /m %msg%
  105.   set skiy=%errorlevel%
  106.   echo . & echo %l1% & echo .
  107.   if %skiy% equ 1 goto lookout
  108.  ::
  109.   echo OR,
  110.   set msg="Should we wipe every destination now online? (y/N): "
  111.   choice /c yn /n /t 11 /d n /m %msg%
  112.   echo . & echo %l1% & echo .
  113.   if %errorlevel% equ 1 set skiy=3 & goto lookout
  114.  ::
  115.   set msg="Shall I just wipe the external Destinations? (Y/n): "
  116.  ::: Won't wipe Q: it's setup as a catch-all.
  117.   choice /c yn /n /t 11 /d y /m %msg%
  118.   echo . & echo %l1% & echo .
  119.   if %errorlevel% equ 1 set skiy=4
  120.  
  121.  
  122. :lookout
  123.   set msg="=*=*=*=*=*=> Backup Outlook Files as well? (Y/n/c): "
  124.   choice /c ync /n /t 7 /d y /m %msg%
  125.   if %errorlevel% equ 3 goto exit3
  126.   set /a backout=%errorlevel%
  127.  ::
  128.   if %backout% neq 1 goto phone
  129.   echo .
  130.   echo Outlook Files:
  131.   set msg="*=*=*=*=*=> Clear the Outlook Backups first? (Y/n): "
  132.   choice /c yn /n /t 7 /d y /m %msg%
  133.   if %errorlevel% equ 2 goto phone
  134.  :: And leave clroutdest==0 ^
  135.   set /a clr=%errorlevel%
  136.  :: == 1 ^ is now implicite
  137.   echo .
  138.   echo Outlook Files:
  139.   set msg="=*=*=> Shall I also clear all backup drives? (Y/n): "
  140.   choice /c yn /n /t 7 /d y /m %msg%
  141.   set /a out=%errorlevel%
  142.  
  143.   :::::::::::::::::::::::::::::::::::::::::
  144.  :: 0==wipe none
  145.  :: 1==just backups on D:
  146.  :: 2==all backup drives.
  147.  :: 3==network systems also.
  148.  :: 4==MAYBE full circle back to source?
  149.  :::::::::::::::::::::::::::::::::::::::::
  150.  
  151.   echo .
  152.   echo Outlook Files:
  153.   set msg="> Shall we also clear all Networked Systems? (Y/n): "
  154.   choice /c yn /n /t 7 /d y /m %msg%
  155.   set /a dest=%errorlevel%
  156.  
  157.   echo .
  158.   echo Outlook Files:
  159.   set msg="*=*=*=> Shall WE MAKE IT A FULL CIRCLE SYNC? (y/N): "
  160.   choice /c yn /n /t 7 /d n /m %msg%
  161.   set /a full=%errorlevel%
  162.  
  163.  
  164. :phone
  165.   echo .
  166.   echo %l1%
  167.   echo .
  168.  ::
  169.   set msg="=*=*=*=*=> Backup Samsung Backups as well? (Y/n/c): "
  170.   choice /c ync /n /t 7 /d y /m %msg%
  171.   if %errorlevel% equ 3 goto exit3
  172.   set /a samsung=%errorlevel%
  173.   if %samsung% neq 1 goto photos
  174.   echo .
  175.   echo  Phone Backups:
  176.   set msg=">Wipe all backup destinations now available? (y/N): "
  177.   choice /c yn /n /t 7 /d n /m %msg%
  178.   set /a clrphodest=%errorlevel%
  179.  
  180.  
  181. :photos
  182.   echo .
  183.   echo %l1%
  184.   echo .
  185.  ::
  186.   set msg="==> Would you like to then check Old Photos? (y/N): "
  187.   choice /c yn /n /t 12 /d n /m %msg%
  188.   set /a olde=%errorlevel%
  189.   echo .
  190.   echo %l1%
  191.   echo .
  192.  ::
  193.   set msg="==> Did you want to then Pause at the End? (y/N/c): "
  194.   choice /c ync /n /t 19 /d n /m %msg%
  195.   if %errorlevel% equ 3 goto exit3
  196.   set /a review=%errorlevel%
  197.   echo .
  198.  
  199.  
  200.   :::::::::::::::::::::::::::[ MAIN BODY ]:::::::::::::::::::::::::::::
  201.  
  202.   ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  203.  :: NOTE: backup Playlists, Desktop, Documents, Photos,
  204.  :: Favorites & Downloads :: Only Restores Source from D:\
  205.  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  206. :control
  207.   if not exist %copy% echo .
  208.   if not exist %copy% echo %sl%
  209.   if not exist %copy% echo            ***  Ctrl Program NOT Found.  ***
  210.   if not exist %copy% echo %sl%
  211.   if not exist %copy% echo .
  212.   if not exist %copy% goto outlook
  213.  ::
  214.   set /a sgnl=0
  215.   call %copy%
  216.  ::
  217.   if %sgnl% equ 2 goto exit3
  218.  
  219.   :: V7.9.7.xx rote mods
  220.   if %sgnl% equ 5 goto recover
  221.   if %sgnl% equ 4 if exist %test% goto start
  222.   if %sgnl% neq 4 goto outlook
  223.  
  224.   echo .
  225.   echo %sl%
  226.   echo             **** Dummy forgot to Unlock D: ****
  227.   echo %sl%
  228.   echo .
  229.  
  230.   set msg="Try again to update D: (Y/n)? "
  231.   choice /c ynoc /n /t 300 /d o /m %msg%
  232.   if %errorlevel% equ 1 goto start
  233.   if %errorlevel% equ 3 pause
  234.   if %errorlevel% equ 4 goto exit3
  235.   goto outlook
  236.  
  237.  
  238.   :::::::::::::::::::::::::::::::::::::::::::
  239.  :: Recovery Restores Sources from Copies ::
  240.  :::::::::::::::::::::::::::::::::::::::::::
  241. :recover
  242.   echo .
  243.   echo %sl%
  244.   echo                      **  ********  **
  245.   echo                 ***     -WARNING!-     ***
  246.   echo       *****   You are on the road to Recovery!   *****
  247.   echo                 ***     -WARNING!-     ***
  248.   echo                      **  ********  **
  249.   echo %sl%
  250.   echo .
  251.   echo %l1%
  252.   echo .
  253.   set msg="*=*=*=*=*=>  Recopy Destinations to Sources? (y/N): "
  254.   choice /c yn /n /t 45 /d n /m %msg%
  255.   if %errorlevel% neq 1 goto start
  256.   set /a r3v3rs3=2
  257.   goto control
  258.  
  259.  
  260.   :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  261.  :: Sync Outlook with D: && I: && X: && Daddio when available.  ::
  262.  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  263. :outlook
  264.   set /a exit2=0
  265.   if %backout% neq 1 goto exit1
  266.  :: exit2 var is used in called processes to flag an exception.
  267.   set nf=could not be found.
  268.   if not exist %outs% echo The Outlook "Handler Program" %nf%
  269.   if not exist %outs% echo ****
  270.   if not exist %outs% echo %outs%
  271.   if not exist %outs% goto exit1
  272.  ::
  273.   call %outs%
  274.  
  275.  
  276.   :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  277.  ::        *** Tasks Completed, Main Program Exiting ***        ::
  278.  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  279.   title %mstr%
  280.   if %exit2% gtr 0 goto exit2
  281.  
  282. :exit1
  283.   echo %l2%
  284.   echo      **   Computer Backups Completed Successfully!   **
  285.   echo %l2%
  286.  
  287.   :: But only after backing up my phone backups.
  288. :exit2
  289.   if %r3v3rs3% equ 2 goto exit3
  290.   if %samsung% neq 1 goto exit0
  291.   if exist %sams% call %sams%
  292.  ::
  293.   if %exit2% neq 0 goto exit0
  294.   echo .
  295.   echo %sl%
  296.   echo            *** Victoria Backup is Backed Up!  ***
  297.   echo %sl%
  298.   echo .
  299.  
  300. :exit0
  301.   if %olde% neq 1 goto exit3
  302.   if not exist %oldr% goto exit3
  303.   if exist %smsg% call %smsg%
  304.   echo .
  305.   if not exist %fileo% copy /a /v /y %errr%,%fileo%
  306.  ::
  307.  :::::::::::::::
  308.   set /a exit2=0
  309.   call %oldr%
  310.  :::::::::::::::
  311.  ::
  312.   if %exit2% neq 0 goto exit3
  313.   echo .
  314.   echo %l2%
  315.   echo ** Old Photos Synced up to date! %date% @ %time% **
  316.   echo %l2%
  317.  REM echo .
  318.  
  319. :exit3
  320.   set /a exit2=0
  321.   if exist %exidos% call %exidos%
  322.  :: See: exit_main.bat for more info.
  323.   if %exit2% equ 4 goto restart
  324.   exit /b %errorlevel%
  325.  
  326.  
  327.  
  328. ::       100% -JpE-
  329.  
  330.  
  331.  
  332.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement