<p>I'm trying to write some SQL that will delete files of type '.7z' that are older than 7 days.</p>
<p>Here's what I've got that's not working:</p>
<pre><code>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
</code></pre>
<p>I've also tried changing the '1' at the end to a '0'.</p>
<p>This returns 'success', but the files aren't getting deleted.</p>
<p>I'm using SQL Server 2005, Standard, w/SP2.</p>

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.