Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :start
- @echo off
- set vers=v6.4.3.15 20231007002511
- set p1=Started %date% @ %time% Pacific Time : Quick Backups to D and E
- title %p1%
- cls
- echo .
- echo .
- echo ***************************************************************
- echo ** **
- echo ** ***************************************************** **
- echo ** ** This is linked by a Scheduled Task and it ** **
- echo ** ** is Setup to Auto Run Ever 15 minutes while ** **
- echo ** ** I'm logged onto the system but not if not! ** **
- echo ** ***************************************************** **
- echo ** ** = Batch Script Original Code by -JpE- = ** **
- echo ** ***************************************************** **
- echo ** **
- echo ***************************************************************
- echo ** **** Backing Up Changes in Key Folders **** **
- echo ***************************************************************
- echo ** Global Access Software Release: %vers% **
- echo ***************************************************************
- :::[ User Input For Wipe of E: ]:::
- echo . & echo . & set /a wiper1=1
- set msg="Should I Wipe Drive E:\? (y/N): "
- choice /c yn /n /t 5 /d n /m %msg%
- if %errorlevel% equ 1 set /a wiper1=2
- :::[ Program Shot-Caller ]:::
- echo . & set sourcej="C:\Users\%username%\%task2%"
- set err=0 & if not exist %sourcej% set err=1 & goto error
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- call :doer Documents
- call :doer Pictures
- call :doer Favorites
- call :doer Downloads
- call :doer Desktop
- :::[ User Input For Pause After Run ]:::
- :quit
- set msg="Pause to review the scrollback buffer? (y/N): "
- choice /c yn /n /t 7 /d n /m %msg%
- if %errorlevel% gtr 1 goto return
- echo . & echo Pausing to examine. What happened?
- echo . & pause & echo . & goto quit
- :::::::::::::[ Reusable Functions ]:::::::::::::
- :::[ Sets up Folders to Backup below ]:::
- :doer <stringVar task2>
- setlocal
- set task2=%~1
- set sourcej="C:\Users\%username%\%task2%"
- set destinj="D:\Copies\My %task2%"
- if exist %destinj% call :doit %sourcej% %destinj%
- set destinj="E:\My %task2%"
- ::: New Feature 20230714124123 by -JpE-
- if %wiper1% gtr 1 del /f /s /q %destinj%"\"*.*
- if exist %destinj% call :doit %sourcej% %destinj%
- set destinj="U:\Copies\My %task1%"
- if exist %destinj% call :doit %sourcej% %destinj%
- endlocal
- exit /b %errorlevel%
- :::[ This function does nearly all the work! ]:::
- :doit <stringVar Source, stringVar Destination>
- setlocal
- set x=%~1
- set y=%~2
- echo .
- if exist "%x%" if exist "%y%" echo Copying %x% to %y% & xcopy "%x%\"*.* "%y%" /D /E /V /C /F /G /R /K /Y /B /J /Z & echo .
- endlocal
- exit /b %errorlevel%
- :::[ Exit Main or handle error ]:::
- :error
- if %err% equ 1 echo . & echo You freaky, man! Source is Unavailable.
- echo . & echo %errorlevel% & echo . & pause & echo .
- :return
- echo Bye!
- ::: 100% -JpE- :::
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement