Can not delete a file in SQL Server Agent

  • I am unable to delete an existing file using the following code in SQL Server Agent as a step in a jpb:

    cd D:\IndependentExtracts

    del IndependentExtractsLog.txt

    It runs. It reports as a success, but the file remains.

    Any help on how to delete a file on SQL Server as a job?

    Thanks,

    (58.30115757480578, -134.4143772125244)

  • Hmm, I thought that only the first command was executed in the CmdExec steps of the Agent?

    Try it like this:

    del D:\IndependentExtracts\IndependentExtractsLog.txt

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Thanks, that worked. I guess only one command per step.

    (58.30115757480578, -134.4143772125244)

Viewing 3 posts - 1 through 2 (of 2 total)

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