Thursday, May 12, 2005

Add Date String to Backup Jobs

Both the GUI and command-line versions of the Sharepoint Backup and Restore Utility allow you to specify the location and prefix for SPS backup files; however, they do not provide a time-stamp feature for multiple date backup scenarios (daily, weekly, etc.). To prepend the date to your backup job in the format 'mm_dd_yy', use the following syntax:

%date:~4,2%_%date:~7,2%_%date:~10,4%

To include a timestamp in the format 'hh-mm', add the following syntax:

%time:~0,2%_%time:~3,2%

If you are running spsbackup from the command-line, the command would look like this:

spsbackup.exe /all /file \\{server}\{directory}\%date:~4,2%_%date:~7,2%_%date:~10,4%-%time:~0,2%_%time:~3,2%