I get this error:

Executing the query "EXECUTE master.dbo.xp_delete_file 0,N'\\SQLSvr..." failed with the following error: "xp_delete_file() returned error 2, 'The system cannot find the file specified.'". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

The server is running SQL Server 2008 R2 doing backups on one server to save to a remote server using UNC paths; file extension is ".bak".


Much as the error message states, it can't find the file N'\\SQLSvr..."

If you know the file does exist, then that usually points to a permission problem with either the account SQL Agent is executing as or if you've created it, a credentials proxy account. Either way, it can't access the network share or it does not have permission to perform the delete operation.

I'd first verify the account can access the share, then look at folder permissions and ensure it has delete privilege.

  • you're right. thanks. what threw me off was the fact that since it backups up to a different server using the same account i had set it up with, it should have been able to cleanup too using those same credentials. anyways on the share and the ntfs, i added the server/computer(destination) itself to the security permissions with full control and that did it. thanks again!
    – shilezi
    Oct 22 '13 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.