【发布时间】:2013-05-30 17:38:08
【问题描述】:
您好,我是 java 新手,我想知道如何访问文件夹中的文件。
我的要求是, 我已成功压缩图像文件,然后将其写入临时文件。 现在我想访问文件夹中的每个文件,以便我可以单独检查文件的大小以执行一些操作。
请告诉我如何动态访问文件夹中的每个文件。
这是压缩然后访问文件夹的代码。
BufferedImage resizeImageBmp = resizeImage(originalImage, type);
ImageIO.write(resizeImageBmp, "png", new File(tempDir + roots[i].getName())); //Compressing the file
String Temp = tempDir; //Path to the temporary folder
//Temp1 = ((Temp.length() / 1024)/1024);
if((Temp.length()) > 6){
//writeToDir(Temp,failureDir);
//System.out.println(Temp);
System.out.println(Temp);
}
else{
//System.out.println(Temp);
System.out.println(Temp);
}
【问题讨论】:
标签: java compression directory subdirectory