Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- REM This is my quick and dirty backup script for backing up the contents of my
- REM Desktop, Documents, and Pictures folders, and backing up the names of the
- REM files and folders of the Music and Downloads folder to my flash drive
- REM which is too small to store everything.
- REM stands for REMark.
- REM %USERPROFILE% is an environment variable containing the path to the user's
- REM home folder.
- set src=%USERPROFILE%
- set dest=D:
- set robocplog="%USERPROFILE%\quick-backup log.txt"
- REM robocopy stands for robust file copy, and it copies files from a folder to
- REM another.
- REM /s includes all subfolders, but only the ones that aren't empty.
- REM /purge deletes files from the destination that aren't present in the source
- REM folder.
- REM /MT enable multi threading.
- REM /xd excludes specified directories from being copied.
- REM /R defines the number of maximum retries to transfer a file on error.
- REM /W defines the time between retries to transfer a file in seconds.
- set robocopy=robocopy /s /purge /MT /R:3 /W:1 /log+:%robocplog%
- %robocopy% "%src%\Desktop" "%dest%\Desktop"
- REM The circumflex is required to split a command through multiple lines.
- %robocopy% "%src%\Documents" "%dest%\Documents" ^
- /xd "%USERPROFILE%\Documents\Code\Workspaces\Rust\redox" ^
- /xd "%USERPROFILE%\Documents\Code\Workspaces\Rust\hematite" ^
- /xd "%USERPROFILE%\Documents\Code\Workspaces\Rust\orbgame"
- %robocopy% "%src%\Pictures" "%dest%\Pictures"
- %robocopy% "%src%\Videos" "%dest%\Videos"
- REM Hide the robocopy log file.
- attrib %robocplog% +h
- REM dir prints a folder's contents.
- REM /b omits unnecessary information.
- REM /s includes subfolders.
- set dir=dir /b /s
- REM The right arrow redirects dir's output to a file.
- %dir% "%src%\Music" > "%dest%\Music.txt"
- %dir% "%src%\Downloads" > "%dest%\Downloads.txt"
Add Comment
Please, Sign In to add comment