Hopefully someone has seen this before. I am attempting to copy all directory contents in the source to another directory, as well as for i began while using Commons FileUtils.copyDirectorytoDirectory method(File src, File dest). The code is fairly simple:

public static void copyDirtoDir(String src, String dest) {
    File s = new File(src);
    File d = new File(dest);
    try {
        FileUtils.copyDirectoryToDirectory(s, d);
    } catch (IOException e) {

To operate this test on Linux, I am running the application like a JAR and passing the src and dest strings in the command line. However , after i look into the resulting directory size after execution, there is a massive difference in dimensions (using the replicated dir around two times how big the initial - checked using 'du -sh').

Then i simply attempted with nio.FileChannels, the following:

public static void copyFile(File in, File out) throws IOException {
    FileChannel source = new FileInputStream(in).getChannel();
    FileChannel destination = new FileOutputStream(out).getChannel();

        source.transferTo(0, source.size(), destination);


Calling this process for each file within the directory. The resulting size out of this variation can also be around two times how big the initial. Basically perform a report on the directories' contents, those are the same.

Can there be any missing parameter or something like that that may be leading to this size difference?

Unsure what's happening, however, you can use diff to diff directories. I am certain will pin lower the variations easily.

The javadoc states that copyDirectoryToDirectory copies the origin directory and all sorts of its contents to a listing of exactly the same title within the specified destination directory.

Without seeing your directory structure, I am speculating this might make the double data. Any reason you are not while using simple FileUtils.copyDirectory() ?