You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mario Madunic <ha...@imag.net> on 2007/08/22 18:45:10 UTC

escaping tilde in filename extension

I'm trying to move files according to extension and content prior to parsing and
some files have an extension of .xml~. These files are duplicates of existing
.xml files and I want to keep them for legacy purposes. I've been unable to move
them using the following

<move todir="${l_Drive}workFolder\archived">
  <fileset dir="${l_Drive}workFolder\drop01">
    <filename name="*.xml~" />
  </fileset>
</move>

The tilde seems to be causing problems.

Any help will be appreciated.

Marijan (Mario) Madunic


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


RE: String replace.

Posted by "Chon, Ae H" <AE...@saic.com>.
Try, this...CDATA will look for that literal string and will not read it
as special chars. 

<replace dir="${server.dir}" value ="<" >
	<include name="*Control.cs" /> 
	<replacetoken><![CDATA[&lt;]]></replacetoken> 
	</replace>

Ae Hwa Chon
chona@saic.com
(W)  703-824-5863

-----Original Message-----
From: user-return-61891-AE.H.CHON=saic.com@ant.apache.org
[mailto:user-return-61891-AE.H.CHON=saic.com@ant.apache.org] On Behalf
Of Andrew Goktepe
Sent: Wednesday, August 22, 2007 9:35 PM
To: Ant Users List
Subject: Re: String replace.

Try escaping the & character xml-style with &amp; instead of \&

pattern="&amp;lt;"

-Andrew

On 8/22/07, Chun Ji <CJ...@pro-unlimited.com> wrote:
>
>
> Hi,
>
> Does someone know how to replace a string such as "&lt;" to be "<" in 
> a html file by ANT.
> The target that I have created in my build.xml is :
> "
> ...
> <target name="change">
>         <replaceregex file="test.html" pattern="\&lt;" replace="<" />
>         <replaceregex file="test.html" pattern="\&gt;" replace=">" /> 
> </target> ..
> ",
>
> but I see such errors:
> "
> The value of attribute "replace" associated with an element type 
> "replaceregex" must not contain the '<' character.
> "
>
>
> Thanks a lot,
>
>
> Charlie
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional

> commands, e-mail: user-help@ant.apache.org
>
>

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


Re: String replace.

Posted by Andrew Goktepe <an...@gmail.com>.
Try escaping the & character xml-style with &amp; instead of \&

pattern="&amp;lt;"

-Andrew

On 8/22/07, Chun Ji <CJ...@pro-unlimited.com> wrote:
>
>
> Hi,
>
> Does someone know how to replace a string such as "&lt;" to be "<" in a
> html file by ANT.
> The target that I have created in my build.xml is :
> "
> ...
> <target name="change">
>         <replaceregex file="test.html" pattern="\&lt;" replace="<" />
>         <replaceregex file="test.html" pattern="\&gt;" replace=">" />
> </target>
> ..
> ",
>
> but I see such errors:
> "
> The value of attribute "replace" associated with an element type
> "replaceregex" must not contain the '<' character.
> "
>
>
> Thanks a lot,
>
>
> Charlie
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

String replace.

Posted by Chun Ji <CJ...@pro-unlimited.com>.
Hi, 

Does someone know how to replace a string such as "&lt;" to be "<" in a html file by ANT. 
The target that I have created in my build.xml is : 
"
... 
<target name="change">
	<replaceregex file="test.html" pattern="\&lt;" replace="<" />
	<replaceregex file="test.html" pattern="\&gt;" replace=">" />
</target>
..
", 

but I see such errors: 
"
The value of attribute "replace" associated with an element type "replaceregex" must not contain the '<' character.
"


Thanks a lot, 


Charlie

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


Re: escaping tilde in filename extension

Posted by Mario Madunic <ha...@imag.net>.
Thank you, worked like a charm.

Marijan (Mario) Madunic

Quoting Peter Reilly <pe...@gmail.com>:

> You need to disable the defaultincludes attribute.
> 
> <fileset dir="${i_D}/..."  defaultexcludes="no">
>    <include name="*.xml~"/>
> </fileset>
> 
> http://ant.apache.org/manual/CoreTypes/fileset.html
> 
> Peter
> 
> 
> On 8/22/07, Mario Madunic <ha...@imag.net> wrote:
> > I'm trying to move files according to extension and content prior to
> parsing and
> > some files have an extension of .xml~. These files are duplicates of
> existing
> > .xml files and I want to keep them for legacy purposes. I've been unable to
> move
> > them using the following
> >
> > <move todir="${l_Drive}workFolder\archived">
> >   <fileset dir="${l_Drive}workFolder\drop01">
> >     <filename name="*.xml~" />
> >   </fileset>
> > </move>
> >
> > The tilde seems to be causing problems.
> >
> > Any help will be appreciated.
> >
> > Marijan (Mario) Madunic
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 



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


Re: escaping tilde in filename extension

Posted by Peter Reilly <pe...@gmail.com>.
You need to disable the defaultincludes attribute.

<fileset dir="${i_D}/..."  defaultexcludes="no">
   <include name="*.xml~"/>
</fileset>

http://ant.apache.org/manual/CoreTypes/fileset.html

Peter


On 8/22/07, Mario Madunic <ha...@imag.net> wrote:
> I'm trying to move files according to extension and content prior to parsing and
> some files have an extension of .xml~. These files are duplicates of existing
> .xml files and I want to keep them for legacy purposes. I've been unable to move
> them using the following
>
> <move todir="${l_Drive}workFolder\archived">
>   <fileset dir="${l_Drive}workFolder\drop01">
>     <filename name="*.xml~" />
>   </fileset>
> </move>
>
> The tilde seems to be causing problems.
>
> Any help will be appreciated.
>
> Marijan (Mario) Madunic
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

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