7 Şubat 2012 Salı

Sharepoint 2010 - 7 Day Backup script

Hi,
I found this post very handy and updated for myself:

http://blog.integrii.net/?p=122

Just schedule this batch file to work in every day, so you ll have a backup process which keeps your backups up to 7 days. It automatically deletes the file after 7th day.


You can also create a email job and send an email with the attachment of the spbackup.txt file.


@echo off
echo ===============================================================
echo Back up the farm to D:\BAK\FarmBackup - 7 day
echo ===============================================================

REM ===============================================================
REM Variables
REM ===============================================================

set location=D:\BAK\FarmBackups
set templog=D:\BAK\FarmBackups\spbackup.txt


REM ===============================================================
REM Rename folders and delete 7th
REM ===============================================================

rmdir /s /q %location%\day7
ren %location%\day6 day7
ren %location%\day5 day6
ren %location%\day4 day5
ren %location%\day3 day4
ren %location%\day2 day3
ren %location%\day1 day2
ren %location%\today day1
mkdir %location%\today

REM ===============================================================
REM Run the Backup program
REM ===============================================================


C:
cd C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN
@echo off
stsadm.exe -o backup -directory %location%\today -backupmethod full > %templog%
echo completed

Hiç yorum yok:

Yorum Gönder