xp_delete_file not deleting files on share drive

  • Thanks for catching that opc.three! I didn't realize that I copied in the wrong version. That one didn't multiply the variable by -1 so it required that a negative number be set. I have edited the script above with the fix.

  • What version is your sql server instance at?

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

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

  • Read, write and modify permissions are available for the user id which is running the job.

    more over i have tried with my windows id still is not deleting but manualy i have access to delete the files.

    we are using SQL 2005 SP4.

    Regards
    Durai Nagarajan

  • yes xp_delete_file was fixed in SP2 but i have seen issues re appear in SP4. I generally use a VB script to manage file removal of backups and logs

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

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

  • If you can provide the command\statement you are running then it would be easier to check what is the issue. xp_delete_file deletes only native SQL backups and for extension value provide "bak" instead of ".bak". It doesn't like the dot in the extension.

  • --Had problems with file delete,. which turned out to be the format of the date provided to the routine

    --

    declare@del_datechar(8)

    set@del_date = convert(char(8),getdate()-2,112)

    exec master.dbo.xp_delete_file 0,'c:\temp','bak',@del_date,1

Viewing 6 posts - 16 through 20 (of 20 total)

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