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

前端 未结 7 1872
星月不相逢
星月不相逢 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条回答
  •  梦毁少年i
    2021-02-01 15:23

    You can use this brute force technique as pure ant, which is specially useful in maven where the additional conditionals aren't available.
    The mkdir will do nothing if the directory already exists, and the delete will fail if the folder cannot be deleted for some reason. The condition of the file not being there is common in a build script where one of the build steps fail but the initial clean was performed.

    
        
        
    
    

提交回复
热议问题