GlobalAccessSoftware icon

SyncOlderPhotos.bat

GlobalAccessSoftware | PRO | 11/16/23 05:55:33 AM UTC | 0 ⭐ | 362 👁️ | Never ⏰ | []
Batch |

8.13 KB

|

Software

|

0 👍

/

0 👎

 
 
@echo off
title *** SyncOldPhotos.bat by -JpE- 20230212010002 ***
:: TestsNOTwell Simplified to a folder or computer. Oh well.
set ace="\\DADDIO-PC\Daddio_Older_Photos\125 NASA Pictures (Illuminati, Freemasons)\ace1.jpg"
::
set bats=C:\Users\%username%\Documents\AAA Sync2Laptop\Batch Files\BCS-Suite
:: 
if exist %fileo% goto start
:: If ^ not AAA calling, set time var to now:
set timethen=%time%
set datethen=%date%
set fileo="%bats%\caller_check.txt"
set RunT="%bats%\runtime_display.bat"
:: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 
:start
set /a sup=0
set /A dad=0
set /A bup=0
 
:restart
set ver=v7.9.9.47 20230515015522 by -JpE-
set /A aok=0
echo .
echo .
::
set b1=****************************************************************
set b2=**   ******************************************************   **
set b3=***   ***   ***   ***   ***   ****   ***   ***   ***   ***   ***
echo %b1%
echo %b3%
echo %b1%
echo **   *                         *                          *   **
echo **   ****       *    Custom Software by JpE    *       ****   **
echo **      *                      *                       *      **
echo %b2%
echo **   **    Adapted 20210421021349 SyncOlderPhotos.bat    **   **
echo %b2%
REM echo %b2%
REM echo **                                                            **
echo **   Run from the JpE Side Only now. 20220420042022           **
REM echo **                                                            **
echo %b2%
echo **   %ver%                        **
echo %b1%
echo %b3%
echo %b2%
echo **   Syncing older photos with Daddio and running backups.    **
::
echo %b1%
echo **   Today is %datethen% and It is now %timethen%            ** 
echo %b1%
if %bup% gtr 0 goto externals
if %sup% gtr 0 goto externals
if not exist %ace% goto skipit
 
 
:: Daddio is Online
echo **   Please wait. Bringing in Older_Photos from Daddio.       **
echo %b1%
::
set source0="\\DADDIO-PC\Daddio_Older_Photos"
set destin0="D:\Older_Photos"
:: *****************************************************************
xcopy %source0% %destin0% /D /E /V /C /F /G /R /K /Y /B
:: *****************************************************************
echo %b1%
echo **   Today is %date% and It is now %time%            **
echo %b1%
if %errorlevel% equ 0 set /A aok+=1
if %errorlevel% neq 0 goto skipit
 
echo **   Daddio is Online! Now Syncronizing...                    **
echo %b2%
set task=Tasks
if %aok% equ 1 set task=Task 
echo **   %aok% %task% Completed: %destin0% Brought in.         **
echo %b1%
echo **   Please wait while we Sync back to Daddio...              **
echo %b1%
 
set destin1="\\DADDIO-PC\Daddio_Older_Photos"
xcopy %destin0%"\"*.* %destin1% /D /E /V /C /F /G /R /K /Y /B
echo %b1%
echo **   Today is %date% and It is now %time%            ** 
echo %b2%
if %errorlevel% equ 0 set /A aok+=1
if %errorlevel% neq 0 goto skipit
::: was if %aok% equ 2 ^^^^ 
 
set task=Tasks
if %aok% equ 1 set task=Task 
echo **   %aok% %task% completed: Pics Synced to DADDIO.                **
echo %b1%
echo **   Now Syncing to Externals if available.                   **
 
 
:skipit
if %aok% neq 0 goto externals
echo **   DADDIO is NOT Online Right Now.                          **
set /A dad+=1
goto retry
 
 
:externals
echo %b1%
set source1="D:\Older_Photos"
set destin2="X:\%username%-PC\Older_Photos"
set destin3="I:\Older_Photos"
set destin4="H:\Older_Photos"
set destin5="R:\Older_Photos"
 
set /A which=0
if exist %destin2% set /A which+=1
if exist %destin3% set /A which+=2
if exist %source1% set /a which+=4
if exist %destin4% set /a which+=8
if exist %destin5% set /a which+=16
 
if %which% lss 4 echo **   Older Photos Source drive is currently Offline.          **
if %which% lss 4 set /a sup+=1
if %which% lss 4 goto retry
 
if exist %destin2% goto backup
if exist %destin3% goto backup
if exist %destin4% goto backup
if exist %destin5% goto backup
:: NOTE: Doesn't return here in this language so this is okay.
 
echo **   No backup drives are currently Online.                   **
set /A bup+=1
 
 
:retry
if %sup% gtr 7 goto ending
if %bup% gtr 3 goto ending
if %dad% gtr 3 goto externals
 
:: Can't default to Yes or it would hang below foreverafter.
set msg="**   Bring it online and try again? (y\N): "
choice /c yn /n /t 15 /d n /m %msg%
 
if %errorlevel% gtr 1 if %bup% gtr 0 goto ending
if %errorlevel% gtr 1 if %sup% gtr 1 goto ending
if %errorlevel% gtr 1 goto externals
 
echo **   Press any key when ready to try again.                   **
echo %b1%
echo **
pause
::: Programmatic pause for user action.
echo **
echo %b1%
goto restart
 
 
::::::::::::::::::::::::::::::::::::::::::::::::::::
::: reusable function saves on redundant code    :::
::: line 2 is just in case something slips past. :::
::::::::::::::::::::::::::::::::::::::::::::::::::::
:copy2 <dir to copyto>
set dir="%~1"
if not exist %dir% echo **   %dir% is not online right now. & echo %b3%
if exist %dir% if exist %source1% xcopy %source1%"\"*.* %dir% /D /E /V /C /F /G /R /K /Y /B
exit /b %errorlevel%
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
 
:backup
echo **   Please wait while I check our backup archives.           **
if %which% equ 0 goto ending
if %which% leq 4 goto ending
if %which% equ 6 goto backup1
if not exist %destin2% goto backup1
echo %b1%
call :copy2 %destin2%
echo %b1%
if %errorlevel% equ 0 set /A aok+=1
if %errorlevel% neq 0 goto backup1
echo **   Success! %destin2% is NOW Up to Date.     **
echo %b2%
set task=Tasks
if %aok% equ 1 set task=Task 
echo **   %aok% %task% Completed: %destin2% Brought.     **
REM echo %b2%
 
:backup1
REM echo pause 1
REM pause
if %which% equ 5 goto success
if not exist %destin3% goto backup2
echo %b1%
call :copy2 %destin3%
echo %b1%
if %errorlevel% equ 0 set /A aok+=1
if %errorlevel% neq 0 goto backup2
echo **   Success! %destin3% is NOW Up to Date.            **
echo %b2%
set task=Tasks
if %aok% equ 1 set task=Task 
echo **   %aok% %task% Completed: %destin3% Brought in.         **
REM echo %b2%
 
REM set source1="D:\Older_Photos"
REM set destin2="X:\%username%-PC\Older_Photos"
REM set destin3="I:\Older_Photos"
REM set destin4="H:\Older_Photos"
REM set destin5="R:\Older_Photos"
 
:backup2
REM echo pause 2
REM pause
if %which% lss 8 goto success
if not exist %destin4% goto backup3
echo %b1%
call :copy2 %destin4%
echo %b1%
if %errorlevel% equ 0 set /a aok+=1
if %errorlevel% neq 0 goto backup3
echo **   Success! %destin4% is NOW Up to Date.            **
echo %b2%
set task=Tasks
if %aok% equ 1 set task=Task 
echo **   %aok% %task% Completed: %destin4% Brought in.         **
REM echo %b2%
REM echo pause 3
REM pause
 
 
:: Latest addition
:backup3
REM echo pause 4
REM pause
if %which% lss 16 goto success
echo %b1%
call :copy2 %destin5%
echo %b1%
if %errorlevel% equ 0 set /a aok+=1
if %errorlevel% neq 0 goto ending
echo **   Success! %destin5% is NOW Up to Date.            **
echo %b2%
set task=Tasks
if %aok% equ 1 set task=Task 
echo **   %aok% %task% Completed: %destin5% Brought in.         **
REM echo pause 5
REM pause
 
 
:success
echo %b1%
set txt=Backup 
if %which% geq 7 set txt=Backups
echo **   Process Finished: External %txt% Completed.            **
REM echo pause 6
REM pause
 
 
:ending
echo %b1%
echo **   Today is %date% and It is now %time%            ** 
echo %b1%
 
if exist %fileo% goto noexit
:: if called by AAA-Sync.bat, do RunT at the end of it instead.
set sl=         /*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\
set l1=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
set l2=%b2% & set vers=     %ver%
if not exist %RunT% echo %RunT% cannot be found!
if exist %RunT% call %RunT%
:: See modifications in runtime_display.bat
 
 
:bbye
REM echo pause 7
REM pause
echo %b1%
set msg="**      S)tart over, P)ause or Q)uit? (Q): "
choice /c spq /n /t 40 /d q /m %msg%
echo %b1%
if %errorlevel% equ 1 goto start
if %errorlevel% neq 2 goto noexit
:: This pause is programmed and not just for testing.
echo **
pause
echo **
goto bbye
 
 
:noexit
 
:: Ttttttttthhhhhhhaaaaaatttttttssssss ALL Folks!
 
:: EOF 100% -JpE-
 
 
 

Comments