Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

question from:https://stackoverflow.com/questions/16552479/delete-files-in-batch-with-without-error-message

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
199 views
Welcome To Ask or Share your Answers For Others

1 Answer

Did you tried something like this :

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...