Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 39129 invoked from network); 11 Aug 2009 18:58:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Aug 2009 18:58:00 -0000 Received: (qmail 61626 invoked by uid 500); 11 Aug 2009 18:58:05 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 61555 invoked by uid 500); 11 Aug 2009 18:58:05 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 61545 invoked by uid 99); 11 Aug 2009 18:58:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Aug 2009 18:58:05 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [209.85.220.209] (HELO mail-fx0-f209.google.com) (209.85.220.209) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Aug 2009 18:57:56 +0000 Received: by fxm5 with SMTP id 5so3442548fxm.22 for ; Tue, 11 Aug 2009 11:57:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.124.17 with SMTP id s17mr466269far.67.1250017055213; Tue, 11 Aug 2009 11:57:35 -0700 (PDT) In-Reply-To: <6A0F3F60F99A9345BEE66A21F61F5E7686C20E@MADARRMAIL7.indra.es> References: <6A0F3F60F99A9345BEE66A21F61F5E7686BC34@MADARRMAIL7.indra.es> <6A0F3F60F99A9345BEE66A21F61F5E7686C061@MADARRMAIL7.indra.es> <7c55bf80908110038q4a4d39bfxd8a1ce015bab6f5@mail.gmail.com> <6A0F3F60F99A9345BEE66A21F61F5E7686C0B3@MADARRMAIL7.indra.es> <7c55bf80908110657q6c0df571l25738466a222006a@mail.gmail.com> <6A0F3F60F99A9345BEE66A21F61F5E7686C20E@MADARRMAIL7.indra.es> Date: Tue, 11 Aug 2009 20:57:35 +0200 Message-ID: <7c55bf80908111157x553b4cf2sadeaa253b9d803c2@mail.gmail.com> Subject: Re: Another options From: Francis GALIEGUE To: Ant Users List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Tue, Aug 11, 2009 at 16:20, Redondo Gallardo, Raul Maria wrote: > Well, I'll try it: > > For example: In a main folder C: with different subfolders structure I ne= ed to find the folder(s) which contain the file with name filev2.txt. After= I must to copy all the files of this directory to another folder and launc= h a java program from ANT. Is this possible?. > > For example: > > It exist the structure of folders: > C:\home\folder01\file.txt > C:\home\folder01\file2.txt > C:\Work\folder10\folder20\fileA.txt > C:\Work\folder10\folder20\fileB.txt > C:\Work\folder10\folder20\fileC.txt > C:\Work\folder10\folder20\filev2.txt > C:\Mom\folder40\folder50\fileA.txt > C:\Mom\folder40\folder50\fileB.txt > C:\Mom\folder40\folder50\filev2.txt > C:\happy\file.txt > > I must to find in C: the folders which contains the file filev2.txt and c= opy the files into the same folder to another path and launch a java progra= m. > > When I use fileset, I obtain: > C:\Work\folder10\folder20\filev2.txt; C:\Mom\folder40\folder50\filev2.txt > > With this I would want to do: > 1.- Split the line in two (C:\Work\folder10\folder20\filev2.txt and > =C2=A0 =C2=A0C:\Mom\folder40\folder50\filev2.txt) > > 2.- Obtain the path of the first substring (C:\Work\folder10\folder20) > > 3.- Copy the all the files which exists into this folder to D:\process > > 4.- Launch a file .bat that works with this files > > > These are the four steps which I need, the step number 4 I have solved, b= ut the steps 1, 2 and 3, I've no idea if is it possible to do with ANT. > > > > Do you understand the example? Is it possible to do this? > > Thank you very very much. > > Best regards. > > PS: If you think that exist an easy way to do this, tell me, because the = steps are not fixed, they are the way which I think would be a solution, bu= t it's possible that I'm wrong. > It is possible, either with or without the split. Here is a solution without the split, which makes use of ant-contrib (yes, I just cannot work without it, it's too powerful to be ignored imho). Of course, you'll have to adapt it to what your script expects as an argument, whether the build should fail if the script fails, etc (and note that ant-contrib also has try/catch). Note that while looks great, it has a huge drawback: its output is a property, and properties are immutable. At least, they're immutable with ant 1.6.x, I don't know for ant 1.7.x. --=20 Francis Galiegue ONE2TEAM Ing=C3=A9nieur syst=C3=A8me Mob : +33 (0) 683 877 875 Tel : +33 (0) 178 945 552 fge@one2team.com 40 avenue Raymond Poincar=C3=A9 75116 Paris --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org