SQLTeam.com | Weblogs | Forums

SQL job to move backup file

Hello,

Hope someone can help.

I'm in a new job and am currently manually having to do the following:

(a) go into \vp-doca\backups\archive\ and delete any backups older than three days (*.bak files)
(b) go into \vp-doca\backups\ and move the latest backup into \vp-doca\backups\archive\

Easy-peasy using a batch file but the IT dept won't allow them to be scheduled; they're happy with SQL Agent jobs though (which is handier because the job can fire off an email stating whether the job has succeeded or failed).

Anyone know how I start?

Why wont they allow bat files, how about powershell? Other option is ssis package in a SQL jobs

Don't know, I'm new there and still getting used to all of ITs little "nuances" (they're trying to outlaw ODBC connections into the main production database even though they use a dedicated account whose permissions are limited to a couple of views, for example!)

Use powershell commands in SQL Server agent - it has a powershell subsystem available.