January 1, 2010 at 9:27 pm
Hi All,
Small help required. Need a batch file which does the below functionality.
Step1: Zip files D:\SrcFiles
Step2: place in different drive F:\Archive
[Here\, the system should be able to create a folder with todays date F:\Archive\20100101 and place all the zip files
Step3: delete the existing files
I need this so that i can zip my sql server backups and move it to a different folder or any tape device or so....
Thanks!
January 2, 2010 at 11:50 am
while you can do it from within SQL server with some TSQL commands, guess what....all the work goes out to xp_cmdshell to call programs like 7zip/winzip/pkzip, and then the MOVE or COPY function from the command prompt anyway....so why not do it from the OS as a bat or cmd file instead?
for example, if you were going to use 7zip, you get the syntax of the command line to zip stuff up here:
http://dotnetperls.com/7-zip-examples
once the zip is made, the syntax of the COPY function can be retrieved from COPY /?; ie
COPY "c:\backups\Full\Fulldevice.bak" "Y:\Monday.BAK or COPY "c:\backups\Full\Fulldevice.zip" "Y:\"
with those commands tested and working, you can make a .cmd or .bat file, and eitehr call it with the Operating system's Scheduled Tasks, or via xp_cmdShell, if it is enabled, and also if the SQL server Service Account has access to the network share you want to move it to;
I always think scheduled tasks are easier.
Lowell
January 2, 2010 at 1:53 pm
January 4, 2010 at 6:07 am
Hey,
Am using SQL 2000 and that is the reason why am going for a windows batch file.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply