I want to copy a directory tree with empty (but necessary!) directories with apache commons io 2.1. But it doesn’t copy empty directories!
My code looks like this:
FileUtils.copyDirectory(new File(sourceDir), new File(targetDir));
Can I tell FileUtils to copy empty directories too? Or is it a bug in “commons io”?
I just tested this myself using apache commons 2.1 (using the code line below) and for me it does copy empty directories too.
with this structure
Both
hello.txtandemptyDirshowed up innew_test_2as well.Perhaps an SSCCE would be useful.