How to check if directory exists before deleting it, using ANT?

前端 未结 7 1889
星月不相逢
星月不相逢 2021-02-01 14:43

Using ANT, how can i make sure that directory exists before attempting to remove it?

As part of my current clean task, i



        
7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-01 15:30

    For this specific case, I'm not going to answer the question "how to find if a directory exists", because that's already been answered, but I'm just going to point out that in your clean task you can use failonerror="false" to keep the ant task from exiting. This should be suitable in a clean task because if there's nothing to clean, it should not be a problem.

        
            
            ....
            
        
    

    This is useful if you don't want to install ant-contrib or can't for some reason.

提交回复
热议问题