I have to copy latest backup from a network path and bring that to my SQL server physical drive for restore, I have to do that using agent job.
This is what i am doing.
Created a SQL server agent job
1) XCOPY source *.bak /Y destination < This copies all the files, but I need the latest file > 2) Ren *bak mydbbackup.bak <**added this into step 2 of job **>
What mistake am i doing here ?
*Are there any xcopy **/**commands which can copy the latest files only and ignore old files ?
Is there a way i can do that using another SQLCMD command besides creating a stored procedure*