BASH   17
backup bat
Guest on 3rd February 2023 01:28:59 PM


  1. @echo off
  2. echo.
  3. if X%2 == X goto SYNTAX
  4.  
  5. if exist %2\nul goto SAVE
  6. echo The removable disk must not be present.
  7. echo 2s of attempt.
  8. break
  9. if exist %2\nul goto SAVE
  10. echo The removable disk must not be present.
  11. echo Backup not performed. End of treatment.
  12. echo.
  13. break
  14. go to END
  15.  
  16. :SAVE
  17. rem choice "Do you want to back up %1 to %2" /T:O,30
  18. if errorlevel 2 goto end
  19. echo Backup in progress...
  20. echo.
  21. rem XCOPY %1\*.* %2 /D /E /F
  22. XCOPY %1\*.* %2 /D /E /Y
  23. echo.
  24. if errorlevel 2 goto ERROR
  25. go to END
  26.  
  27. :ERROR
  28. echo.
  29. echo An error has occurred!
  30. echo Directory backup not complete.
  31. echo.
  32. break
  33. go to END
  34.  
  35.  
  36. :SYNTAX
  37. echo.
  38. echo Syntax: backup.bat source target
  39. echo with source which is the directory to save
  40. echo and target which is the backup directory
  41. echo.
  42. break
  43.  
  44. :END
  45. echo.

Raw Paste

Login or Register to edit or fork this paste. It's free.