You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by jo...@ronin-technologies.com on 2006/05/08 22:18:00 UTC

Recursive Text Replacement in Files with no Extension

Hi,

I'm trying to use a "replace" task to recursively replace 
a string in a set of files, but it only seems to work if 
the file names have an extension (e.g. **/*.java).  In my 
case, I am trying to recursively edit the set of files 
named "Root" that exist with the CVS subdirectories of 
project checked out from CVS.

The task I'm trying looks like this:

<replace
    summary="yes"
    dir="./"
    token="foo"
    value="bar"
    includes="**/Root"/>

and returns:

[replace] Replaced 0 occurrences in 0 files

even though there are many files name "Root", in 
subdirectories of the current directory, which contain the 
string "foo".  Is there a way to specify a fileSet of 
files which do not have file extensions?

TIA,
Joe

This is ant 1.5.3 on Solaris


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


Re: Recursive Text Replacement in Files with no Extension

Posted by jo...@ronin-technologies.com.
That was the problem.

Thanks,
Joe

On Mon, 8 May 2006 16:31:34 -0400
  Robert Clark <ro...@quest.com> wrote:
> On Monday May 8, 2006 16:18, joe@ronin-technologies.com 
>wrote:
>> I'm trying to use a "replace" task to recursively 
>>replace
>> a string in a set of files, but it only seems to work if
>> the file names have an extension (e.g. **/*.java).  In 
>>my
>> case, I am trying to recursively edit the set of files
>> named "Root" that exist with the CVS subdirectories of
>> project checked out from CVS.
> 
> I think you are running into the default excludes in all 
>directory 
> based Ant tasks:
> 
> <http://ant.apache.org/manual/dirtasks.html#defaultexcludes>
> 
>> The task I'm trying looks like this:
>>
>> <replace
>>     summary="yes"
>>     dir="./"
>>     token="foo"
>>     value="bar"
>>     includes="**/Root"/>
> 
> Try:
> 
> <replace
>     summary="yes"
>     dir="./"
>     token="foo"
>     value="bar"
>     defaultexcludes="no"
>     includes="**/Root"/>
> 
> - Rob
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
> 

Joe Morrogh
410.379.2277

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


Re: Recursive Text Replacement in Files with no Extension

Posted by Robert Clark <ro...@quest.com>.
On Monday May 8, 2006 16:18, joe@ronin-technologies.com wrote:
> I'm trying to use a "replace" task to recursively replace
> a string in a set of files, but it only seems to work if
> the file names have an extension (e.g. **/*.java).  In my
> case, I am trying to recursively edit the set of files
> named "Root" that exist with the CVS subdirectories of
> project checked out from CVS.

I think you are running into the default excludes in all directory 
based Ant tasks:

<http://ant.apache.org/manual/dirtasks.html#defaultexcludes>

> The task I'm trying looks like this:
>
> <replace
>     summary="yes"
>     dir="./"
>     token="foo"
>     value="bar"
>     includes="**/Root"/>

Try:

 <replace
     summary="yes"
     dir="./"
     token="foo"
     value="bar"
     defaultexcludes="no"
     includes="**/Root"/>

- Rob

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