Skip to content

Instantly share code, notes, and snippets.

@mawiseman
Last active April 29, 2022 01:35
Show Gist options
  • Save mawiseman/614ab7628c1efc2ccce40a7e20d56a50 to your computer and use it in GitHub Desktop.
Save mawiseman/614ab7628c1efc2ccce40a7e20d56a50 to your computer and use it in GitHub Desktop.
Bat file to backup the sitecore Website folder
@echo off
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"
set "datestamp=%YYYY%%MM%%DD%" & set "timestamp=%HH%%Min%%Sec%"
set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%"
set "website=Website"
set "backupfolder=%website%_%fullstamp%"
robocopy.exe %website% "%backupfolder%" *.* /xd "temp" "app_data" /S
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment