Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.38 KB | None | 0 0
  1. @echo off
  2.  
  3. REM *************************
  4. REM *Contador de Directorios*
  5. REM *************************
  6. set contador=1
  7. dir E:\ /B > C:\Users\%USERNAME%\dirs.txt
  8. for /F %%i IN (C:\Users\%USERNAME%\dirs.txt) DO (
  9.  set /A contador+=1
  10.  )
  11.  
  12. REM ************************
  13. REM *Creador de Directorios*
  14. REM ************************
  15. set dd=%Date:~0,2%
  16. set mm=%Date:~3,2%
  17. set yyyy=%Date:~6,4%
  18. set fecha=%dd%-%mm%-%yyyy%
  19. md E:\[0%contador%]_[%fecha%]_[Incremental]
  20.  
  21. REM ********************
  22. REM *Copia de Seguridad*
  23. REM ********************
  24. xcopy C:\DATOS\* E:\[0%contador%]_[%fecha%]_[Incremental]\*.* /M /E /Q /H /K
  25.  
  26. IF ERRORLEVEL 5 goto error
  27. IF ERRORLEVEL 4 goto memoria
  28. IF ERRORLEVEL 2 goto pausado
  29. IF ERRORLEVEL 1 goto vacio
  30. IF ERRORLEVEL 0 goto correcto
  31.  
  32.  
  33. :error
  34. echo [Incremental] A %DATE%, a las %TIME%, hubo un error de escritura en disco. >> C:\copia_seguridad.log
  35. goto fin
  36.  
  37. :memoria
  38. echo [Incremental] A %DATE%, a las %TIME%, No había suficiente memoria o espacio de disco. >> C:\copia_seguridad.log
  39. goto fin
  40.  
  41. :pausado
  42. echo [Incremental] A %DATE%, a las %TIME%, alguien pauso la copia pulsando CTRL+C >> C:\copia_seguridad.log
  43. goto fin
  44.  
  45. :vacio
  46. echo [Incremental] A %DATE%, a las %TIME%, no habia nada que copiar. >> C:\copia_seguridad.log
  47. goto fin
  48.  
  49. :correcto
  50. echo [Incremental] A %DATE%, a las %TIME%, la copia se realizo correctamente. >> C:\copia_seguridad.log
  51.  
  52. :fin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement