Guest User

Untitled

a guest
Jun 24th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. REM This is my quick and dirty backup script for backing up the contents of my
  2. REM Desktop, Documents, and Pictures folders, and backing up the names of the
  3. REM files and folders of the Music and Downloads folder to my flash drive
  4. REM which is too small to store everything.
  5. REM stands for REMark.
  6.  
  7. REM %USERPROFILE% is an environment variable containing the path to the user's
  8. REM home folder.
  9. set src=%USERPROFILE%
  10. set dest=D:
  11. set robocplog="%USERPROFILE%\quick-backup log.txt"
  12.  
  13. REM robocopy stands for robust file copy, and it copies files from a folder to
  14. REM another.
  15. REM /s includes all subfolders, but only the ones that aren't empty.
  16. REM /purge deletes files from the destination that aren't present in the source
  17. REM folder.
  18. REM /MT enable multi threading.
  19. REM /xd excludes specified directories from being copied.
  20. REM /R defines the number of maximum retries to transfer a file on error.
  21. REM /W defines the time between retries to transfer a file in seconds.
  22. set robocopy=robocopy /s /purge /MT /R:3 /W:1 /log+:%robocplog%
  23.  
  24. %robocopy% "%src%\Desktop" "%dest%\Desktop"
  25. REM The circumflex is required to split a command through multiple lines.
  26. %robocopy% "%src%\Documents" "%dest%\Documents" ^
  27. /xd "%USERPROFILE%\Documents\Code\Workspaces\Rust\redox" ^
  28. /xd "%USERPROFILE%\Documents\Code\Workspaces\Rust\hematite" ^
  29. /xd "%USERPROFILE%\Documents\Code\Workspaces\Rust\orbgame"
  30. %robocopy% "%src%\Pictures" "%dest%\Pictures"
  31. %robocopy% "%src%\Videos" "%dest%\Videos"
  32.  
  33. REM Hide the robocopy log file.
  34. attrib %robocplog% +h
  35.  
  36. REM dir prints a folder's contents.
  37. REM /b omits unnecessary information.
  38. REM /s includes subfolders.
  39. set dir=dir /b /s
  40.  
  41. REM The right arrow redirects dir's output to a file.
  42. %dir% "%src%\Music" > "%dest%\Music.txt"
  43. %dir% "%src%\Downloads" > "%dest%\Downloads.txt"
Add Comment
Please, Sign In to add comment