Andrew Goktepe wrote: > > The symlink task (http://ant.apache.org/manual/OptionalTasks/symlink.html) > can be used to create symbolic links with relative paths on a per-file > basis [...] >
Thank you for this hint, once again I see that most of what needs to be done is fairly easy with ant. I wonder why I didn't simply search for "symlink" at http://ant.apache.org/ http://ant.apache.org/ ... But even if I had found the symlink task, I would never have been able to come up with the solution below which is what I need, as I have set of files which I can't pass to the symlink task. (It's a pity that ant does have to do without true loops, but I know that this is one of its strengths.) Andrew Goktepe wrote: > > If that doesn't work and you need to continue down the <apply> path you > could try something like this [...] > That works like a charm for creating relative symbolic links (with constant paths) to several files in one go. Thank you very much for this perfect solution! Andrew Goktepe wrote: > > This is assuming you have a dir structure like this, which is inferred by > your code [...] > Sorry for not having exposed my directory structure more clearly. While my original problem is now solved, I also need to create symlinks to a set of files in another setting. In this case, the path to the resources needs to be dynamic. My directory layout is as follows (given as full paths to prevent indentation trouble): /top /top/src/a/V_0_1/data /top/src/b/V_0_7/data /top/src/c/V_0_3/data /top/build With ${basedir} set to either of the version-number subdirectories of a, b, or c, I would like to create relative symlinks within top/build that point to all files matching *.txt and *.xml in ${basedir}/data (the file names will never collide). This means that I have to extract the names of the 2 directories immediately above "data" to establish the symlink path. I tried with the following code modeled after your example, but the links are not created and I didn't notice any error: <apply executable="ln" dir="/top/build" relative="true" addsourcefile="false"> <arg value="-sf"/> <targetfile/> <fileset dir="data"> <include name="*.xml"/> <include name="*.txt"/> </fileset> <arg value="."/> <mapper type="regexp" from="^.*/([^/]+/[^/]+)/data/([^/]+)$$" to="../src/\1/data/\2"/> </apply> Do you have an idea how I could make this work? Maybe the other way round, i.e. looking for the resources from the target directory's point of view? Yves -- View this message in context: http://www.nabble.com/Creating-SymLinks-with-relative-paths-tf4751944.html#a13603537 Sent from the Ant - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]