Advertisement
GlobalAccessSoftware

justdocumentsNOW.bat

Nov 16th, 2023
915
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 3.29 KB | Software | 0 0
  1.  
  2.  
  3. :start
  4.   @echo off
  5.   set vers=v6.4.3.15 20231007002511
  6.    
  7.   set p1=Started %date% @ %time% Pacific Time : Quick Backups to D and E
  8.   title %p1%
  9.                    cls
  10.   echo  .
  11.   echo  .
  12.   echo  ***************************************************************
  13.   echo  **                                                           **
  14.   echo  **   *****************************************************   **
  15.   echo  **   **    This is linked by a Scheduled Task and it    **   **
  16.   echo  **   **    is Setup to Auto Run Ever 15 minutes while   **   **
  17.   echo  **   **    I'm logged onto the system but not if not!   **   **
  18.   echo  **   *****************************************************   **
  19.   echo  **   **   = Batch Script Original Code  by -JpE- =      **   **
  20.   echo  **   *****************************************************   **
  21.   echo  **                                                           **
  22.   echo  ***************************************************************
  23.   echo  **        **** Backing Up Changes in Key Folders ****        **
  24.   echo  ***************************************************************
  25.   echo  ** Global Access Software Release: %vers%  **
  26.   echo  ***************************************************************
  27.  
  28.                       :::[ User Input For Wipe of E: ]:::
  29.  
  30.   echo . & echo . & set /a wiper1=1
  31.   set msg="Should I Wipe Drive E:\? (y/N): "
  32.   choice /c yn /n /t 5 /d n /m %msg%
  33.   if %errorlevel% equ 1 set /a wiper1=2
  34.  
  35.  
  36.                       :::[ Program Shot-Caller ]:::
  37.  
  38.   echo . & set sourcej="C:\Users\%username%\%task2%"
  39.   set err=0 & if not exist %sourcej% set err=1 & goto error
  40.  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  41.  
  42.   call :doer Documents
  43.   call :doer Pictures
  44.   call :doer Favorites
  45.   call :doer Downloads
  46.   call :doer Desktop  
  47.    
  48.  
  49.              :::[ User Input For Pause After Run ]:::                      
  50. :quit
  51.   set msg="Pause to review the scrollback buffer? (y/N): "
  52.   choice /c yn /n /t 7 /d n /m %msg%
  53.   if %errorlevel% gtr 1 goto return
  54.   echo . & echo Pausing to examine. What happened?
  55.   echo . & pause & echo . & goto quit
  56.  
  57.  
  58.          :::::::::::::[ Reusable Functions ]:::::::::::::
  59.  
  60. :::[ Sets up Folders to Backup below ]:::
  61. :doer <stringVar task2>
  62.   setlocal
  63.   set task2=%~1
  64.   set sourcej="C:\Users\%username%\%task2%"
  65.   set destinj="D:\Copies\My %task2%"
  66.   if exist %destinj% call :doit %sourcej% %destinj%
  67.   set destinj="E:\My %task2%"
  68.  
  69.   ::: New Feature 20230714124123 by -JpE-
  70.   if %wiper1% gtr 1 del /f /s /q %destinj%"\"*.*
  71.  
  72.   if exist %destinj% call :doit %sourcej% %destinj%
  73.   set destinj="U:\Copies\My %task1%"
  74.   if exist %destinj% call :doit %sourcej% %destinj%
  75.   endlocal
  76.   exit /b %errorlevel%
  77.  
  78.  
  79. :::[ This function does nearly all the work! ]:::
  80. :doit <stringVar Source, stringVar Destination>
  81.   setlocal
  82.   set x=%~1
  83.   set y=%~2
  84.   echo .  
  85.   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 .
  86.   endlocal
  87.   exit /b %errorlevel%
  88.  
  89.  
  90.                :::[ Exit Main or handle error ]:::
  91. :error
  92.   if %err% equ 1 echo . & echo You freaky, man! Source is Unavailable.
  93.   echo . & echo %errorlevel% & echo . & pause & echo .
  94.  
  95. :return
  96.   echo Bye!  
  97.  
  98.  
  99.  
  100.   ::: 100% -JpE- :::
  101.  
  102.  
  103.  
  104.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement