I have a batch script with a line like this:
del "%TARGET_DIR%\packages.config"
But if packages.config
does not exist in the target directory it produces an error.
Could Not Find
\\...\packages.config
Is there a command line switch del
that will prevent raising an error the target file is not found? I'm open to using an if exists
if I have to, but I have a number of similar commands, and I'd like to avoid having to do that for every single file I might want to delete.
DEL /Q
does not allow it to silently fail; it still complains. You're going to have to test ahead of time... sorry.