Last active
November 22, 2018 13:12
-
-
Save uchiiii/6452dc8ec8ed4658f6a8634fbdcd9e7f to your computer and use it in GitHub Desktop.
This is used to backup your file or folder on Windows.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal | |
rem FROM refers to the source of your folder or file that you want to backup. | |
set FROM=<ABSOLUTE_PATH> | |
rem TO refers to the destination. | |
set TO=Z:<ABSOLUTE_PATH> | |
set LOG=%~dp0\autocopy.log | |
rem EXCEPT refers to files that you don't want to backup. | |
set EXCEPT=<ABSOLUTE_PATH> | |
set OPT=/MIR /R:3 /W:10 /V /FP /DCOPY:T /LOG:%LOG% /XD:%EXCEPT% /TEE | |
if not exist %FROM% goto error1 | |
if not exist %TO% goto error2 | |
robocopy %FROM% %TO% %OPT% | |
goto end | |
:error1 | |
echo Path-> %FROM% is invalid. | |
goto end | |
:error2 | |
goto Path-> %TO% does not exist. | |
goto end | |
:end | |
endlocal | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use
step1: Download this script onto your PC on windows.
step2: Change the three different <ABSOLUTE_PATH> on it so that it operates as you want.
step3: Put
.\autocopy.bat
to execute the backup.