import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
public class TestIO
{
public static void main(String[] args)
{
try
{
File source = new File("D:/imagetmp/tp-20101028-00001");
File destinationDir = new File("D:/grid");
String sourceFileName = source.getName();
File destination = new File(destinationDir + File.separator
+ sourceFileName);
if (!destination.exists())
{
destination.mkdirs();
}
File[] files = source.listFiles();
for (File file : files)
{
FileUtils.copyFileToDirectory(file, destination);
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
FileUtils快速方便拷贝文件
最新推荐文章于 2024-06-19 12:30:00 发布