Ant check existence for a set of files

前端 未结 3 468
难免孤独
难免孤独 2020-12-09 18:30

In ant, how can i check if a set of files (comma-separated list of paths) exist or not?

For example I need to check if all paths listed in myprop exist

3条回答
  •  佛祖请我去吃肉
    2020-12-09 18:42

    You can use a combination of a filelist, restrict and condition task for this.

    In the below example a filelist is created from the property with the comma-separated list of files. Using restrict a list of the files that don't exist is found. This is placed in a property which will be empty if all the files are found.

    
    
    
    
      
      
        
      
    
    
    
    
        
    
    
    

    You could use something like this to generate a failure message listing the missing files:

    
        
            
        
    
    

提交回复
热议问题