Monday, January 25, 2010

Backup SharePoint Site With Date In Filename

set webApp=
backupFolder=F:\STSADM\
Set YYYY-MM-DD=%DATE:~6,4%-%DATE:~0,2%-%DATE:~3,2%

rem echo Get the current date and time in YYYY-MM-DD-HH-MM-SS format
SET isodt=%date:~10,4%%date:~4,2%%date:~7,2%-%time:~0,2%%time:~3,2%%time:~6,2%
rem echo %isodt%

md %backupFolder%\%webApp%
stsadm -o setsitelock -url
http://%webApp% -lock readonly
stsadm -o backup -url http://%webApp% -filename %backupFolder%%webApp%\%webApp%-%isodt%.datstsadm -o setsitelock -url http://%webApp% -lock none
stsadm -o enumsolutions > %backupFolder%%webApp%\enuSolutions-%isodt%.txt
pause

No comments:

Post a Comment