Delete files in batch with without error message

new picture new · May 14, 2013 · Viewed 42.5k times · Source

I use the command

del "info*" 

to delete a group of files starting with "info". The problem is that sometimes there is at least one of these files that exist,therefore they are deleted and others times no files exist and and error message happens. I need my script must not block if these files don't exist.

I look at options for del /? but nothing help me go ahead.

Could you help me, please?

Answer

RelevantUsername picture RelevantUsername · May 14, 2013

Did you tried something like this :

IF EXIST [Filename] (
    del [Filename]
) ELSE (
    ...
)