Thanks Darragh. I learned three separate principles in getting this to work with yours and Stefan's help.
With a few adjustments, I got it to work correctly. The following code copied the one file (prefs.js) to the randomly generated folder location: (I've added some comments for anyone who follows this thread later.) <property name="firefox.dir" value="${env.APPDATA}/Mozilla/FireFox/Profiles"/> <path id="path.firefox.default.profile"> <!--Where firefox puts the profiles. I had not been using the path task. --> <dirset dir="${firefox.dir}"> <include name="**/*.default" /> </dirset> </path> <!-- This line was the all important missing get the location (path id) into an actual property. I had not done that. --> <property name="firefox.default.profile.dir" location="${toString:path.firefox.default.profile}" /> <!--The rest is pretty straight forward --> <copy todir="${firefox.default.profile.dir}" > <fileset dir="${apps.dir}/Firefox" > <include name="prefs.js" /> </fileset> </copy> Aaron Mackley | QA Engineering | Digital Technology International | 801-853-5000 | aaron.mack...@dtint.com Transform profitably with our new Targeted Audience Solutions and DTI Cloud. Get started at www.dtint.com. -----Original Message----- From: Bailey, Darragh [mailto:dbai...@hp.com] Sent: Friday, September 10, 2010 10:04 AM To: Ant Users List Subject: RE: Trouble with <copy> and <DirSet> > -----Original Message----- > From: Aaron Mackley [mailto:aaron.mack...@dtint.com] > Sent: 10 September 2010 15:40 > To: user@ant.apache.org > Subject: RE: Trouble with <copy> and <DirSet> > > Stefan, <snip> > I currently have this code: (I am trying to copy prefs.js to > the random > directory *.default.) > > <copy todir="${firefox.dir}"> > <dirset dir="${firefox.dir}"> > <include name="**/*.default"/> > </dirset> > <fileset dir="${apps.dir}/Firefox"> > <include name="prefs.js"/> > </fileset> > </copy> > > > > Is this the right way to go about this? That would attempt to copy the xxxxxxxxx.default directory to the firefox directory. There was a thread a week ago titled "How to get the last folder name?" which should solve this problem for you. > I want to get the path to the last child folder in some parent > directory. Tried this: > > <path id="_lastname"> > <last> > <sort> > <fileset dir="C:\my\parent"/> > </sort> > </last> > </path> > <property name="_lastname2" location="${_lastname}"/> The person had one mistake that was corrected by Matt Benson, he should have used "${toString:_lastname}" in order to convert to a property. So your code would become something like the following: <path id="path.firefox.default.profile"> <dirset dir="${firefox.dir}"> <!-- I'm assumming that to avoid getting a directory below the profile directory, that sort will return the results in the order of the shortest path. --> <first> <sort> <include name="**/*.default" /> </sort> </first> </dirset> </path> <property name="firefox.default.profile.dir" location="${toString:path.firefox.default.profile}" /> <copy todir="${firefox.default.profile.dir}" > <fileset dir="${apps.dir}/Firefox" > <include name="prefs.js" /> </fileset> </copy> This is untested and just constructed based on the person saying that it worked after making the changes suggested. -- Regards, Darragh Bailey --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org