• hisakimatama (11/8/2013)


    Hm. I could be wrong on this, but I believe xp_delete_file will only work on SQL Server backup and report files; that is, files ending in .trn, .bak, and .rpt. It looks like you're trying to delete .txt files with it, which shouldn't work. You may have to resort to using a PowerShell script to do this instead.

    Simbo_mk (11/14/2013)


    I would like to thank each one of you for your replies and suggestions.

    No, this is not a test question. We have jobs that are supposed to delete files older than a certain number of days. For some reasons, the job is not working on our text files.

    Thank you,

    Like hisakimatama said in the second post on this thread (quoted above, as well), xp_delete_file won't delete .txt files. It works only for backup and report files and they have to have the correct embedded header, to boot.

    As a bit of a sidebar, this demonstrates that great care and very careful research/testing should be done before using any undocumented stored procedure.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)