Java File Copy Library 提供了一种简易的方法用于执行大量的文件拷贝工作,可定义批处理进行文件复制,复制的过程可通过一个进度条显示,如下图所示:
示例代码:
Source[] sources = new Source[]{ // all files from directory /home/user/source1/ new Source("/home/user/source1/", ".*"), // all *.java files from directory /home/user/source2/ new Source("/home/user/source2/", ".*\\.java") }; String[] destinations = new String[]{ "/home/user/destination1", "/home/user/destination2" }; CopyJob copyJob = new CopyJob(sources, destinations, true/*recursive*/);