Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7133E228D for ; Fri, 6 May 2011 00:20:45 +0000 (UTC) Received: (qmail 69945 invoked by uid 500); 6 May 2011 00:20:45 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 69889 invoked by uid 500); 6 May 2011 00:20:45 -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 69879 invoked by uid 99); 6 May 2011 00:20:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 May 2011 00:20:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 May 2011 00:20:42 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 2D5EEC3A38 for ; Fri, 6 May 2011 00:20:03 +0000 (UTC) Date: Fri, 6 May 2011 00:20:03 +0000 (UTC) From: "Sebb (JIRA)" To: issues@commons.apache.org Message-ID: <232190989.26746.1304641203182.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1437856922.24418.1304595843118.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (IO-271) FileUtils.copyDirectory should be able to handle arbitrary number of files 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-271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13029669#comment-13029669 ] Sebb commented on IO-271: ------------------------- Using list() instead of listFiles() would be possible, but would only double the size of a directory that could be processed. The only way to truly fix the problem would be to use a method that provided access to the file names one by one, but there does not appear to be a method to do this. AFAICT FileUtils does not override anything - anyway, why would it be necessary to delay updating the mod. date on the target file? Personally, I don't think this is worth implementing. Users can always implement their own filtering to split the transfer into chunks. Or just make sure that directories don't contain so many files - this is likely to cause problems elsewhere as well. > FileUtils.copyDirectory should be able to handle arbitrary number of files > -------------------------------------------------------------------------- > > Key: IO-271 > URL: https://issues.apache.org/jira/browse/IO-271 > Project: Commons IO > Issue Type: Improvement > Components: Utilities > Affects Versions: 2.0.1 > Reporter: Stephen Kestle > > File.listFiles() uses up to a bit over 2 times as much memory as File.list(). The latter should be used in doCopyDirectory where there is no filter specified. > This memory usage is a problem when copying directories with hundreds of thousands of files. > I was also thinking of the option of implementing a file filter (that could be composed with the inputted filter) that would batch the file copy operation; copy the first 10000 (that match), then the next 10000 etc etc. > Because of the lack of ordering consistency (between runs) of File.listFiles(), there would need to be a final file filter that would accept files that have not successfully been copied. > I'm primarily concerned about copying into an empty directory (I validate this beforehand), but for general operation where it's a merge, the modification date re-writing should only be done in the final run of copies so that while batching occurs (and indeed the final "missed" filtering) files do not get copied if they have been modified after the start time. (I presume that I'm reading FileUtils correctly in that it overrides files...) -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira