xp_delete_file - error message when no files for deleting
I managed to get the same error when executing the query on a random chosen folder (that was empty).

Message
Executed as user: DOMAIN\ServiceAccount. xp_delete_file() returned error 2, 'The system cannot find the file specified.' [SQLSTATE 42000] (Error 22049).  The step failed.


At first, I wanted to see if we could use aTRY CATCH Block to 'muffle' the sound of the error screams our SQL Server is throwing at us.

It still fails with the same error message, so we cannot use that to get a 'false positive'.

I do think that the error is happening because either 


The folder does not exist
The service account does not have permissions on the folder


When executing on a folder where i knew that my service account did not have permissions on, i got the same error.
After changing the folder, and adding my service account as 'full control' on the folder, it worked, even if it was empty.



Permissions on the folder for my service account



The folder is empty 



Checking the job T-SQL



Looks good

Message


  Executed as user: DOMAIN\ServiceAccount. The step succeeded.


This was tested on SQL Server 2014 (SP2-CU12) 

There could be better alternatives for the proc, or other
 workarounds.