commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Kestle (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IO-271) FileUtils.copyDirectory should be able to handle arbitrary number of files
Date Sun, 08 May 2011 11:07:03 GMT

    [ https://issues.apache.org/jira/browse/IO-271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13030470#comment-13030470
] 

Stephen Kestle commented on IO-271:
-----------------------------------

Yeah, I tend to agree in the general case. Perhaps it's a case of providing an override switch
to be low memory instead of fast(er). Although I think if this were to be done, I'd check
memory usage every 100k files and evaluate whether reversion to names is necessary.

Of course, the chances of hitting this sort of issue when using a filter is even less likely:
so why not just use an Object array for {{list()}} and {{listFiles(filter)}}? Resolving {{File
originFile = filter == null ? new File(srcDir, files[i]) : files[i];}} isn't so bad is it?



> 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
>            Priority: Minor
>
> 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

Mime
View raw message