I want to create an Ant target that copies files in a directory to a destination directory with the same folder structure, plus one more subfolder appended.
For exam
You could use a regexp mapper:
I've used hard-coded file.separators to shorten. Basically, you split the path to the input file (from) into directory and filename (capture \1
and \2
) and then insert the \x
extra element between them (to).
I'm not clear on your example - it looks like you want to match 'bar.pdf' and rename it to 'foo.pdf', as well as changing the directory. If you need to do that, you might consider chaining a couple of simpler regexp mappers, rather than trying to cook up one complex one:
When using a glob mapper, you need to specify one wildcard *
in the from field:
Both to and from are required and define patterns that may contain at most one *. For each source file that matches the from pattern, a target file name will be constructed from the to pattern by substituting the * in the to pattern with the text that matches the * in the from pattern. Source file names that don't match the from pattern will be ignored.
So something like this might work: