You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Burger, Wolfgang" <Wo...@solarworld.de> on 2011/03/28 15:17:55 UTC

Curling throug a list of files

Hi,
i try to curl through an list of files and saving the output to a special directory.
The idea is to make static html out of compiled php.

Here comes my Code;
[default.properties]
file.index = index.html start.html

Running Curl with just one file and working well:
                <target name="curlSitetest">
                               <exec executable="cmd">
                                               <arg value="/c"/>
                                               <arg value="curl"/>
                                               <arg value="${http.server}/index"/>
                                               <arg value="-o"/>
                                               <arg value="/cygdrive/c/wamp/index.html"/>
                               </exec>
                </target>


Now I want to iterate over file.index like that:
                <target name="curlSite">
                                               <apply executable="cmd">
                                                               <fileset dir="mobile" includes="${file.crawl}" />
                                                               <arg value="/c"/>
                                                               <arg value="curl"/>
                                                               <arg value="${http.server}/index/"/>
                                                               <srcfile/>
                                                               <arg value="-o"/>
                                                               <arg value="/cygdrive/c/wamp/"/>
                                                               <targetfile/>
                                               </apply>
                </target>

I got a problem because curl like to do the curl inside the mobile-dir instead of using the http-host.
Does anybody knows an answer for that instead of copying the first codeblock with different filenames?



**********************************************************************************************

<< ------------------- notice ------------------- >> 
This message may contain confidential or privileged information and is
intended only for the use of the addressee named above. If you are not the
intended recipient of this message, you are hereby notified that you must
not use, copy, disclose or take any action based on this message or
information herein. If you have received this message by error, please
advise the sender immediately and delete this message. 
Thank you for your cooperation.
 
<< ------------------- notice ------------------- >>
Aktiengesellschaft mit Sitz in Bonn � Amtsgericht Bonn HRB 8319
Vorsitzender des Aufsichtsrates: Dr. Claus Recktenwald
Vorsitzender des Vorstandes: Dr.-Ing. E. h. Frank Asbeck
Vorstand Finanzen: Dipl.-Kfm. Philipp Koecke
Vorstand Vertrieb: Dipl.-Ing. Frank Henn
Vorstand operatives Gesch�ft: Dipl.-Ing. Boris Klebensberger
 
 
**********************************************************************************************

Re: Curling throug a list of files

Posted by Matt Benson <gu...@gmail.com>.
On Mon, Mar 28, 2011 at 8:17 AM, Burger, Wolfgang
<Wo...@solarworld.de> wrote:
> Hi,
> i try to curl through an list of files and saving the output to a special directory.
> The idea is to make static html out of compiled php.
>

Your <apply> example seems fraught with problems, e.g. the fact that
your use of <srcfile> and <targetfile> will cause these arguments to
be separate from the ones to which you would seem to want them
concatenated and thus part of the same argument.  Both these elements
are documented as supporting prefix/suffix attributes since 1.8.0.
However, do you with certainty need to call a curl process?  Can you
not use the various <get> type tasks available with Ant, or indeed
simply <copy> a number of <url> resources?

Matt

> Here comes my Code;
> [default.properties]
> file.index = index.html start.html
>
> Running Curl with just one file and working well:
>                <target name="curlSitetest">
>                               <exec executable="cmd">
>                                               <arg value="/c"/>
>                                               <arg value="curl"/>
>                                               <arg value="${http.server}/index"/>
>                                               <arg value="-o"/>
>                                               <arg value="/cygdrive/c/wamp/index.html"/>
>                               </exec>
>                </target>
>
>
> Now I want to iterate over file.index like that:
>                <target name="curlSite">
>                                               <apply executable="cmd">
>                                                               <fileset dir="mobile" includes="${file.crawl}" />
>                                                               <arg value="/c"/>
>                                                               <arg value="curl"/>
>                                                               <arg value="${http.server}/index/"/>
>                                                               <srcfile/>
>                                                               <arg value="-o"/>
>                                                               <arg value="/cygdrive/c/wamp/"/>
>                                                               <targetfile/>
>                                               </apply>
>                </target>
>
> I got a problem because curl like to do the curl inside the mobile-dir instead of using the http-host.
> Does anybody knows an answer for that instead of copying the first codeblock with different filenames?
>
>
>
> **********************************************************************************************
>
> << ------------------- notice ------------------- >>
> This message may contain confidential or privileged information and is
> intended only for the use of the addressee named above. If you are not the
> intended recipient of this message, you are hereby notified that you must
> not use, copy, disclose or take any action based on this message or
> information herein. If you have received this message by error, please
> advise the sender immediately and delete this message.
> Thank you for your cooperation.
>
> << ------------------- notice ------------------- >>
> Aktiengesellschaft mit Sitz in Bonn – Amtsgericht Bonn HRB 8319
> Vorsitzender des Aufsichtsrates: Dr. Claus Recktenwald
> Vorsitzender des Vorstandes: Dr.-Ing. E. h. Frank Asbeck
> Vorstand Finanzen: Dipl.-Kfm. Philipp Koecke
> Vorstand Vertrieb: Dipl.-Ing. Frank Henn
> Vorstand operatives Geschäft: Dipl.-Ing. Boris Klebensberger
>
>
> **********************************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org