Okay, i got it. <target name="zipIt"> <!-- zip and copy txtfiles to testing--> <for param="file" keepgoing="true"> <path> <fileset dir="./test" includes="*.txt" /> </path> <sequential> <basename property="[EMAIL PROTECTED]" file="@{file}" suffix=".txt"/> <zip destfile="${testing_dir}/[EMAIL PROTECTED]" update="true"> <fileset file="@{file}" /> </zip> </sequential> </for> </target>
Thank Nicolas for your help! Sven Nicolas Vervelle wrote: > I made a typo, I was thinking of <propertyregex> from ant-contrib also. > You could use it before the call to <zip>. > It will require some work especially to find the good pattern to use. > > Other idea is using <basename> to extract the filename from the complete > path. > Just remember that a property is immutable, so you need to use a > different name each time. Try using @{file} as part of the property name > > > Sven Waibel wrote: > >> How can i insert it in my target? >> Some ideas? >> >> Thanks a lot! >> Sven >> >> Nicolas Vervelle wrote: >> >> >> >>> Maybe a <replaceregexp> to create yourself the destfile ? >>> >>> Sven Waibel wrote: >>> >>> >>> >>>> ant-contrib helps in so many cases, thanks. >>>> >>>> I got some problems with <for>. >>>> >>>> That's my target: >>>> >>>> <for param="file" keepgoing="true"> >>>> <path> >>>> <fileset dir="." includes="*.txt" /> >>>> </path> >>>> <sequential> >>>> <zip destfile="${testing-folder}/@{file}" update="true"> >>>> <fileset file="@{file}" /> >>>> </zip> >>>> </sequential> >>>> </for> >>>> >>>> Now i get an error: >>>> [for] D:\test\build.xml:702: Problem creating zip: >>>> D:\testing_today\D:\test\tt1.zip >>>> >>>> I tried <mapper type="flatten"/>, but it doesn't work with <fileset> >>>> or <path> >>>> >>>> Sven >>>> >>>> Nicolas Vervelle wrote: >>>> >>>> >>>> >>>> >>>> >>>>> A solution that works: use <for> task from ant-contrib. >>>>> Maybe there's an other solution using only ant core tasks, but I don't >>>>> have the idea ;) >>>>> >>>>> Sven Waibel wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>> Hi, >>>>>> >>>>>> i have several files i want to zip. >>>>>> >>>>>> Situation: >>>>>> >>>>>> d:\test\tt1.txt >>>>>> d:\test\tt2.txt >>>>>> d:\test\tt3.txt >>>>>> d:\test\tt4.txt >>>>>> d:\test\tt5.txt >>>>>> d:\test\tt6.txt >>>>>> >>>>>> I want to get the following: >>>>>> >>>>>> d:\testing\tt1.zip >>>>>> d:\testing\tt2.zip >>>>>> d:\testing\tt3.zip >>>>>> d:\testing\tt4.zip >>>>>> d:\testing\tt5.zip >>>>>> d:\testing\tt6.zip >>>>>> >>>>>> In my build.xml i can specify one zip - filename only: >>>>>> >>>>>> <zip destfile="${testing-folder}/tt1.zip"> >>>>>> <fileset dir="." includes="*.txt" /> >>>>>> </zip> >>>>>> >>>>>> Thanks >>>>>> Sven >>>>>> >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>> >>>> >>>> >>>> >>>> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]