You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David Jordan <Da...@objectidentity.com> on 2001/12/01 01:35:59 UTC

renaming of files

I have a situation where I have a bunch of "configuration" files
that exist in 3 forms. One of these 3 forms needs to be used during
a build. There are very strict rules about the file name and suffix.
Assume the suffix is .xml and the file name is "file".
So at a certain step in the build process I need a file
named file.xml that should be in a certain directory.
But in the source directory, I need three different variations
of this file.xml.
I was thinking I would have 3 files named
  file.xml.n
  file.xml.d
  file.xml.a
(The n,d, and a denote the type of file.)
My question is how in Ant can I have a build step that would
basically strip off one of the .n, .d, .a from the rest of the
file name, placing the resulting file.xml in either the same
or different directory? I'd have a build step that would specifically
pick one of these three files (based on the .n, .d, .a) and
remove the additional suffix.

There are MANY directories that will have this same situation,
so I'd like it to be expressed fairly generically.
I have never written my own Ant task and don't have time to do that
now, but someday I do hope to learn how to implement my own task,
but now I don't have the luxury of the time.

Another question, something that will be part of the same build
process is that these files will exist in a particular directory
structure, where the root is named "source". But I will need to
move these files to a mirror copy directory structure under a
different root, say it is named "dest". Can this be done generically
without requiring the full paths under both "source" and "dest".
Further, it would be really cool if I could use the wildcarding in
ant on file sets that would do this for all the MANY directories
automatically, so I don't have to explicitly create the above
file naming step for each individual directory.

Recommendations would be really appreciated!

David Jordan
mailto:david.jordan@objectidentity.com
Object Identity, Inc.
www.objectidentity.com



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: renaming of files

Posted by David Jordan <Da...@objectidentity.com>.
I found the documentation on mapper, this handled it for me.

David Jordan
mailto:david.jordan@objectidentity.com
Object Identity, Inc.
www.objectidentity.com



> -----Original Message-----
> From: David Jordan [mailto:David.Jordan@objectidentity.com] 
> Sent: Friday, November 30, 2001 7:36 PM
> To: 'Ant Users List'
> Subject: renaming of files
> 
> 
> 
> I have a situation where I have a bunch of "configuration" files
> that exist in 3 forms. One of these 3 forms needs to be used during
> a build. There are very strict rules about the file name and suffix.
> Assume the suffix is .xml and the file name is "file".
> So at a certain step in the build process I need a file
> named file.xml that should be in a certain directory.
> But in the source directory, I need three different variations
> of this file.xml.
> I was thinking I would have 3 files named
>   file.xml.n
>   file.xml.d
>   file.xml.a
> (The n,d, and a denote the type of file.)
> My question is how in Ant can I have a build step that would
> basically strip off one of the .n, .d, .a from the rest of the
> file name, placing the resulting file.xml in either the same
> or different directory? I'd have a build step that would specifically
> pick one of these three files (based on the .n, .d, .a) and
> remove the additional suffix.
> 
> There are MANY directories that will have this same situation,
> so I'd like it to be expressed fairly generically.
> I have never written my own Ant task and don't have time to do that
> now, but someday I do hope to learn how to implement my own task,
> but now I don't have the luxury of the time.
> 
> Another question, something that will be part of the same build
> process is that these files will exist in a particular directory
> structure, where the root is named "source". But I will need to
> move these files to a mirror copy directory structure under a
> different root, say it is named "dest". Can this be done generically
> without requiring the full paths under both "source" and "dest".
> Further, it would be really cool if I could use the wildcarding in
> ant on file sets that would do this for all the MANY directories
> automatically, so I don't have to explicitly create the above
> file naming step for each individual directory.
> 
> Recommendations would be really appreciated!
> 
> David Jordan
> mailto:david.jordan@objectidentity.com
> Object Identity, Inc.
> www.objectidentity.com
> 
> --
> To unsubscribe, e-mail:   
> <mailto:ant-user-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <ma...@jakarta.apache.org>
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>