Sunday, November 01, 2009

Backup with DateTime

Want to make a batch file that is making backup to your SharePoint site and add to the file name a date? or add also the time?

Use this command in your batch file:

stsadm -o backup -url http://siteurl -filename sitename%date:~-4,4%%date:~-10,2%%date:~-7,2%-%time:~0,2%%time:~3,2%.dat

This will make the command as:
stsadm -o backup -url http://siteurl -filename sitename20091101-1159.dat

Where: 20091101 is the date yyyymmdd, and 1159 is HHMM

Update: running this script before 12 PM will render with space not a zero, so add these lines

SET T=%time:~0,2%%time:~3,2%
SET T=%T: =%

which will replace the empty space

stsadm -o backup -url http://siteurl -filename sitename%date:~-4,4%%date:~-10,2%%date:~-7,2%-%T%.dat

No comments:

How to Install and Use RTSP Simple Server

  How to Install and Use RTSP Simple Server   1.   Create a folder to store the app mkdir /etc/rtsp-server cd /etc/rtsp-server   2.  Downloa...