SQL Server Job failing to delete html files out of a folder
It looks like the problem is that, while there is always some file present (so the COPY always succeeds), there is not always a file with the specified extensions.

One quick-and-dirty solution - add the following lines between the COPY and the first DELETE:

ECHO z &gt;&gt; C:\DATA\LOGS\ZZZ_tmp.txt
ECHO z &gt;&gt; C:\DATA\LOGS\ZZZ_tmp.rpt
ECHO z &gt;&gt; C:\DATA\LOGS\ZZZ_tmp.html
ECHO z &gt;&gt; C:\DATA\LOGS\ZZZ_tmp.log


This will create one file with each required extension (or append a z to an existing file with the name).

If you want to go this way, make sure you:


Pick a base file name that you will never see in reality, so you don't corrupt an existing file; and
Document the purpose of the extra files.


Ideally, you'd want to create a solution where you don't fail the DELETE step if there's no matching files, instead of creating dummy files just to get deleted. This can probably be done with CMD.EXE; however, I'd suggest you implement a script in whatever language your department uses (or, at least in whatever language you're comfortable with). Unless you're comfortable with DOS (or whatever you call what CMD.EXE uses now), that's probably not your best solution.

Also - note the COPY will fail if there are no files in C:\DATA\LOGS\ to begin with. This could also be handled by a script, as could what to do if both source and destination directory have a file with the same name.