I've played around with this, and containsregexp does select files
based upon content and not the name of the file. There might be a way
around this by using the <scriptselector>. Unfortunately, I don't know
JavaScript or Apache BSF well enough to figure out how this might
work.
Does anyone know Javascript well enough to help out?
An example of a <scriptselector> based upon the length of the name is
shown here:
<
http://ant.apache.org/manual/CoreTypes/selectors.html#scriptselector>
On Tue, Jun 23, 2009 at 4:42 PM, Jack Blan<
anandtheboss@...> wrote:
>
> Hi,
>
> I have 'src' folder and a 'dest' folder. The 'src' folder has the following
> files:
> 1) ans_key.tif
> 2) arrow.tif
> 3) eqn_y=x+1.tif
> 4) re teach.tif
> 5) ab+cd.tif
>
> I want to copy all files that conform to a naming convention to 'dest'
> folder. The rules are simple: only allowed characters in file names are
> a-z, A-Z, 0-9, dash(-), underscore(_) and period(.). Which means, I want
> only files 1 and 2 to be copied over to 'dest'. For this purpose, I wrote
> the following build.xml:
>
> <project name="name of project" default="copy_graphics" basedir=".">
> <target name="copy_graphics" description="Copy Graphics">
> <copy overwrite="true" todir="dest">
> <fileset dir="src" includes="**/*.tif">
> <containsregexp expression="^[a-zA-Z0-9\._-]+$"/>
> </fileset>
> </copy>
> </target>
> </project>
>
> But it didn't work. What's more confusing is except for file 2 (arrow.tif
> ), all others get copied.
>
> I read in one of the forums that <containsregexp> looks in the content
> rather than the filename. So I tried playing around various combinations
> of:
> <fileset dir="src">
> <filename name="**/^[a-zA-Z0-9\._-]+\.tif$"/>
> </fileset>
>
> That didn't work either. Can anybody please help?
>
> Thanks!
>
> --
> View this message in context:
http://www.nabble.com/Using-regular-expressions-to-select-files-when-using-ant-copy-task-tp24174053p24174053.html> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
user-unsubscribe@...
> For additional commands, e-mail:
user-help@...
>
>
--
David Weintraub
qazwart@...
---------------------------------------------------------------------
To unsubscribe, e-mail:
user-unsubscribe@...
For additional commands, e-mail:
user-help@...