Thank you!
ddevienne wrote: > > On Thu, Jan 7, 2010 at 4:02 PM, leroybrownbpj <[email protected]> wrote: >> I'm working on a project currently where we need to deploy an artifact to >> a >> server via an ant task which takes the fully qualified file path and >> name. >> When this script runs the artifact will be in a directory like this: >> >> location/deployable-artifact-1.0.3.9.war >> >> My problem is that in order to keep track of our builds the artifact's >> name >> will contain the build number (as above) and therefor I won't know before >> deployment time what the file's name will be. The containing directory >> will >> hold only this file, and be empty otherwise and the filename's prefix >> ("deployable-artifact-" here) will be constant as well so I would not >> think >> that it would be incredibly difficult to get the name of the file in that >> directory but I'm not sure how to go about this. >> >> Any suggestions are appreciated. > > There are likely several ways to do that, a <fileset id="foo"> with > the magic ${toString:foo} conversion, or a <path> with <pathconvert>, > and I'm likely forgetting others. In any case, it relies on a type > that accepts "wildcards", and then converting that type to a string > you put into a <property>. Something that might look like > > <fileset id="thefile" dir="location" includes="deployable-artifact-*.war" > /> > <property name="thefile" value="${toString:thefile}" /> > > (not tested). --DD > > PS: properties and references are in separate "namespaces" so I used > the same name for the id and the property name. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > -- View this message in context: http://old.nabble.com/Getting-the-name-of-the-only-file-in-a-directory-tp27067808p27068420.html Sent from the Ant - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
