윈도우 서버 자료 OneDrive 백업 배치프로그램
2022.06.13
윈도우 서버 자료 OneDrive 백업 배치프로그램
@echo off
setlocal enabledelayedexpansion
set sourceDir[0]="C:\~~~\WWWROOT"
set sourceDir[1]="C:\~~~\DB\a"
set sourceDir[2]="C:\~~~\DB\b"
set sourceDir[3]="C:\~~~\DB\c"
set targetDir[0]="WWWROOT"
set targetDir[1]="DB\a"
set targetDir[2]="DB\b"
set targetDir[3]="DB\c"
set targetPath="D:\OneDrive\~~~\Backup\"
set todayDate=%date:~0,4%%date:~5,2%%date:~8,2%\
for /l %%n in (0,1,3) do (
set fullPath=%targetPath%%todayDate%!targetDir[%%n]!
echo !fullPath!
if not exist !fullPath! (
md !fullPath!
)
xcopy !sourceDir[%%n]! !fullPath! /e /h /k /y
)