Alex Rivera | Logout

SQL Server xp_delete_file not deleting files

Asked 2008-10-17T15:15:55.760
13

I'm trying to write some SQL that will delete files of type '.7z' that are older than 7 days.

Here's what I've got that's not working:

DECLARE @DateString CHAR(8)
SET @DateString = CONVERT(CHAR(8), DATEADD(d, -7, GETDATE()), 1)
EXECUTE master.dbo.xp_delete_file 0, 
                  N'e:\Database Backups',N'7z', @DateString, 1

I've also tried changing the '1' at the end to a '0'.

This returns 'success', but the files aren't getting deleted.

I'm using SQL Server 2005, Standard, w/SP2.

Edit
Report

1 Answer

0

Try changing the first parameter from 0 to 1.

Here is a small summary on xp_delete_file I just found. Sounds a bit like you'd be out of luck with this procedure.

answered 2008-10-17T15:58:37.140

Your Answer