Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 61087 invoked from network); 29 Oct 2009 13:00:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Oct 2009 13:00:37 -0000 Received: (qmail 38603 invoked by uid 500); 29 Oct 2009 13:00:36 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 38534 invoked by uid 500); 29 Oct 2009 13:00:35 -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 38524 invoked by uid 99); 29 Oct 2009 13:00:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Oct 2009 13:00:35 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [193.201.183.194] (HELO smtp4.huk-coburg.de) (193.201.183.194) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Oct 2009 13:00:33 +0000 Received: from sscd0027.huk-coburg.de ([10.148.152.136]) by smtp4.huk-coburg.de with Microsoft SMTPSVC(6.0.3790.3959); Thu, 29 Oct 2009 14:00:11 +0100 Received: by sscd0027.huk-coburg.de (Postfix, from userid 8) id B396E70005; Thu, 29 Oct 2009 14:00:11 +0100 (CET) Received: from sscd0003.dmz.huk.de (sscd0003.dmz.huk.de [10.148.152.133]) by sscd0027.huk-coburg.de (Postfix) with ESMTP id AA59270004 for ; Thu, 29 Oct 2009 14:00:11 +0100 (CET) Received: from SMX00002.lan.huk-coburg.de (unverified) by sscd0003.dmz.huk.de (HUK-COBURG Mailrelay2) with ESMTP id for ; Thu, 29 Oct 2009 14:00:11 +0100 Received: from VMX00100.lan.huk-coburg.de ([10.130.66.152]) by SMX00002.lan.huk-coburg.de ([10.131.34.183]) with mapi; Thu, 29 Oct 2009 14:00:11 +0100 From: "Rebhan, Gilbert" To: 'Ant Users List' Date: Thu, 29 Oct 2009 14:00:11 +0100 Subject: RE: Alternative for taks to check a pattern of file existence Thread-Topic: Alternative for taks to check a pattern of file existence Thread-Index: AcpYhxEMFlMDtpBLR5mdtFBWkPCVeAACjpGwAAF5j0A= Message-ID: References: <26110901.post@talk.nabble.com> In-Reply-To: Accept-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: de-DE MIME-Version: 1.0 Content-Language: de-DE Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable P.S. :=20 you may also check for existence of specific files via fileset if that is enough for your purpose =3D and then f.e. =3D or .. or Regards, Gilbert -----Original Message----- From: cvsusr [mailto:spers@rediffmail.com]=20 Sent: Thursday, October 29, 2009 12:00 PM To: user@ant.apache.org Subject: Alternative for taks to check a pattern of file existe= nce /* Hi, I need to check for existence of files with some extension say *.txt in a folder and if present execute a target.. I found only task which checks for the existence of single file only when the name of the file known. I wanted to check whether *.txt is present or not.. if present execute a target.. */ one possible solution, the extension you're are looking for is part of the glob attribute =3D your/path/**/*.yourextension means recursive your/path/*.yourextension means non recursive examplescript, look for files with .xml extension in C:/Temp and set property with number of found files the condition checks whether there are *.xml files in C:/Temp - means property set by scriptdef !=3D 0 and then your targets use if / unless with condition property $project.setProperty "#{$attributes.get('property')}", Dir.glob("#{$attributes.get('glob')}").length.to_s ${xmlfiles} files found .. no files found .. Regards, Gilbert --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org