Friday, 20 March 2009

Copy only today's backups

Batch file to achieve this >

set dd=%date:~0,2%
set mm=%date:~3,2%
set yy=%date:~6,4%

set today=%mm%-%dd%-%yy%

md x:\sqlbackup


del x:\*.* /s/q
echo %date% - %time% - copying database backups >> x:\Backuplog.txt
echo %date% - %time% - copying database backups
xcopy e:\sqlbackup\*.* x:\sqlbackup /D:%today% /r/v/y/s

This was helpful >
String Manipulation in Dos Batch files

No comments: