Ant check existence for a set of files and take action
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   lkrao31
Posted On:   Thursday, May 8, 2014 07:52 AM

  I have a very urgent requirement which I need help & guidance, user passes a list of files in an XML file,below will be the sample   <property-bundle name = "abc">         <action>clean</action>         <target-location>/vst/property/pog/</target-location>         <file-name>test1.props</file-name>         <file-name>test2.props</file-name>         <file-name>test3.props</file-name> </property-bundle> Now based on that acti   More>>

  I have a very urgent requirement which I need help & guidance, user passes a list of files in an XML file,below will be the sample
 
<property-bundle name = "abc">
        <action>clean</action>
        <target-location>/vst/property/pog/</target-location>
        <file-name>test1.props</file-name>
        <file-name>test2.props</file-name>
        <file-name>test3.props</file-name>
</property-bundle>

Now based on that action remove, I have to incorporate logic in build.xml to delete the files in the directory , but for that I want to perform a validation only if the file exists  and the list does not contain any special characters then remove or else throw the build failure error. I was able to read the values from the user input XML and takes those files into a file list property
  <property name="file.list" value="test1.props,test2.props,test3.props"/>
  <target name = "clean">
     <delete>
           <fileset dir="${target.location}" includes  = "${file.list}"/>
     </delete>
  </target>

But with the clean target it only validates if the directory exists since it is fileset but does not do the validation if file exists , I read that filelist does validation for file exists but filelist can work with delete. 
we are using ANT version that comes with our WebSphere in our environment and the version 1.6.5 becuse we are using some of the WebSphere Custom defined ANT tasks, We could not update ANT as it is tightly coupled with our WebSphere upgrade and  in our environment,

I am open to use ant-contrib or any other extenral libraries to solve this , Can you please kindly help me.


Thanks,
 lkrao    <<Less
About | Sitemap | Contact