Deleting old backup files

  • hi,

    Iam using a strored procedure to backup databases, which uses xp_cmdshell command to delete previous day's backup file. Its working for all the databases except one database. I created a job for this, and in that the out file I found the below statement, which I could not understand:

    DEL D:\backup\data\SPProd_Cfg _10-19-2008.bak

    (1 rows(s) affected)

    output

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Could Not Find D:\backup\data\SPProd_Cfg

    Could Not Find C:\WINDOWS\system32\_10-19-2008.bak

    (null)

    Could you plz explain me what its looking in C:\WINDOWS\system32\_10-19-2008.bak

    thanks

  • You have a space after Cfg and before the underscore which is causing the command to fail. Remove the extra space and it should work.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Thanks Jeffrey,

    I thoroughly checked, There is no space after the cfg in Spprod_Cfg. It might be other issue,could you plz advice me

  • In your command DEL D:\backup\data\SPProd_Cfg _10-19-2008.bak there is a space after the Cfg.

    The output you are getting shows it is trying to find two files, spprod_cfg and _10-19-2008.bak; you would get these messages because of the space in the command above.

  • DEL D:\backup\data\SPProd_Cfg _10-19-2008.bak

    The above has a space following Cfg. Don't know what else I can say other than the command you have posted has that space in it which is causing the problem.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • just to re iterate, there is definitely a space after cfg.

    copy the line out to a text file and you'll see it

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply