Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 50232 invoked from network); 27 Apr 2010 18:51:59 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 27 Apr 2010 18:51:59 -0000 Received: (qmail 13674 invoked by uid 500); 27 Apr 2010 18:51:58 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 13363 invoked by uid 500); 27 Apr 2010 18:51:58 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 13353 invoked by uid 99); 27 Apr 2010 18:51:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Apr 2010 18:51:58 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Apr 2010 18:51:55 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o3RIpXTw019704 for ; Tue, 27 Apr 2010 18:51:34 GMT Message-ID: <23512490.39231272394293712.JavaMail.jira@thor> Date: Tue, 27 Apr 2010 14:51:33 -0400 (EDT) From: "James Ring (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (IO-172) Support directory scanning based on Ant-like include/exclude patterns In-Reply-To: <1793264265.1212145065269.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/IO-172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12861492#action_12861492 ] James Ring commented on IO-172: ------------------------------- This is just like http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/base/Predicate.html and http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/base/Predicates.html, except it's ugly and my hands hurt just looking at the example code above. Nicer would be something like: import static org.apache.commons.io.filefilter.IOFileFilters.*; scanDirectory(and(suffix(".xml"), not(name("bad")))); > Support directory scanning based on Ant-like include/exclude patterns > --------------------------------------------------------------------- > > Key: IO-172 > URL: https://issues.apache.org/jira/browse/IO-172 > Project: Commons IO > Issue Type: New Feature > Components: Utilities > Affects Versions: 1.4 > Reporter: Benjamin Bentmann > Fix For: 2.x > > > While IO offers a rich set of {{IOFileFilters}} for finding files in directories, I feel it's missing a concept similar to Ant's file sets. For example, how would one search for files that match "**/*.xml" but that don't match "bad/**"? The sketched example would require to exclude the directory "bad" but only if it is the first component of the path, something like "foo/bad/bar.xml" still needs to be included. > Given the increased flexibility of [Ant-like patterns|http://ant.apache.org/manual/dirtasks.html#patterns], it would be cool to have something similar to Ant's [{{DirectoryScanner}}|http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java?view=markup] available in Commons IO. > Personally, I wouldn't need a full copy of the mentioned class, I believe some method like > {code:java} > Collection scanDirectory(File dir, Collection includes, Collection excludes) > {code} > in {{FileUtils}} would just suffice. Some default excludes like SCM metadata files could be provided as a public static final and unmodifiable string collection. The return value should include path names relative to the base directory instead of absolute paths (it's easy for the caller to resolve the files against the base directory but it's error-prone to relativize absolute paths). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.