File §2
Previously speaking,File can be seen as one ducument, also can be seen as list of documents like directory.
Here,File also can be seen as one directory which does't exist, also can be seen as a whole path of directory which does't exist.
Example1:
File f = new File("C:/Users/caich5/Desktop/test");
if(!f.exist()){
f.mkdirs();
}
If succeed,Directory 'test' will show in the path of 'C:/Users/caich5/Desktop';
File f = new File("C:/Users/caich5/Desktop/test/test/test");
if(!f.exist()){
f.mkdirs();
}
If succeed,Directory 'test/test/test' will show in the path of 'C:/Users/caich5/Desktop';
Tips:difference between file.mkdirs() and file.mkdir();
file.mkdirs(): it means that you can create multi-layer path;
file.mkdir(): it means that you can only create the single-layer path;
Example2:
File f = new File("C:/Users/caich5/Desktop/test.txt");
if(!f.exist()){
f.createNewFile();
}
File §2的更多相关文章
- 记一个mvn奇怪错误: Archive for required library: 'D:/mvn/repos/junit/junit/3.8.1/junit-3.8.1.jar' in project 'xxx' cannot be read or is not a valid ZIP file
我的maven 项目有一个红色感叹号, 而且Problems 存在 errors : Description Resource Path Location Type Archive for requi ...
- HTML中上传与读取图片或文件(input file)----在路上(25)
input file相关知识简例 在此介绍的input file相关知识为: 上传照片及文件,其中包括单次上传.批量上传.删除照片.增加照片.读取图片.对上传的图片或文件的判断,比如限制图片的张数.限 ...
- logstash file输入,无输出原因与解决办法
1.现象 很多同学在用logstash input 为file的时候,经常会出现如下问题:配置文件无误,logstash有时一直停留在等待输入的界面 2.解释 logstash作为日志分析的管道,在实 ...
- input[tyle="file"]样式修改及上传文件名显示
默认的上传样式我们总觉得不太好看,根据需求总想改成和上下结构统一的风格…… 实现方法和思路: 1.在input元素外加a超链接标签 2.给a标签设置按钮样式 3.设置input[type='file' ...
- .NET平台开源项目速览(16)C#写PDF文件类库PDF File Writer介绍
1年前,我在文章:这些.NET开源项目你知道吗?.NET平台开源文档与报表处理组件集合(三)中(第9个项目),给大家推荐了一个开源免费的PDF读写组件 PDFSharp,PDFSharp我2年前就看过 ...
- [笔记]HAproxy reload config file with uninterrupt session
HAProxy is a high performance load balancer. It is very light-weight, and free, making it a great op ...
- VSCode调试go语言出现:exec: "gcc": executable file not found in %PATH%
1.问题描述 由于安装VS15 Preview 5,搞的系统由重新安装一次:在用vscdoe编译go语言时,出现以下问题: # odbcexec: "gcc": executabl ...
- input type='file'上传控件假样式
采用bootstrap框架样式 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> &l ...
- FILE文件流的中fopen、fread、fseek、fclose的使用
FILE文件流用于对文件的快速操作,主要的操作函数有fopen.fseek.fread.fclose,在对文件结构比较清楚时使用这几个函数会比较快捷的得到文件中具体位置的数据,提取对我们有用的信息,满 ...
- ILJMALL project过程中遇到Fragment嵌套问题:IllegalArgumentException: Binary XML file line #23: Duplicate id
出现场景:当点击"分类"再返回"首页"时,发生error退出 BUG描述:Caused by: java.lang.IllegalArgumentExcep ...
随机推荐
- 不能往Windows Server 2008 R2 Server中复制文件的解决方法
目前一直直接往Windows 2008 R2 Server中复制文件(暂时还没有搭建ftp服务),突然不能复制了,于是百度找到了解决方法,特此记录(记忆). 1.在任务管理器中找到“rdpclip.e ...
- C# Asp.net Quartz.NET作业调度之创建、安装、卸载、调试windows服务的简单事例
一.创建windows服务 1.用VS创建windows服务,结果如下: 2.删除默认生成的Service1.cs文件,然后创建自己的服务文件(如:MyService),并修改Program.cs文件 ...
- 如何使用CryptoJS配合Java进行AES加密和解密
注意 1. PKCS5Padding和PKCS7Padding是一样的 2. 加密时使用的key和iv要转换成base64格式 一.前端 1.函数 function encrypt (msg, key ...
- 【托业】【新托业TOEIC新题型真题】学习笔记12-题库八-P7
155.political figure 政治人物 prominent 160.association n.协会,社团; 联合,联系; 联想; rarely adv.很少地; 罕有地; 极精彩地; 珍 ...
- Linux ethtool 命令
ethtool 是用于查询及设置网卡参数的命令,常见用法如下: 注意:该命令只是临时设置,如果网卡重启就失效了,如果想要永久保存应该配置 /etc/sysconfig/network-scripts/ ...
- C# install-package:"xx"已拥有为“xxx”定义的依赖项
可能 nuget自身的版本落后于适配程序包的版本 Visual Studio 2013 更新 NuGet 包管理器 Ø 前言 使用 Visual Studio 中的 NuGet 包管理器下载程序时, ...
- 主成分分析(PCA)原理详解
一.PCA简介 1. 相关背景 在许多领域的研究与应用中,往往需要对反映事物的多个变量进行大量的观测,收集大量数据以便进行分析寻找规律.多变量大样本无疑会为研究和应用提供了丰富的信息,但也在一定程度上 ...
- Win7各版本功能对比
- 多线程——newFixedThreadPool线程池
newFixedThreadPool线程池: 理解: 1.固定线程数的线程池. 2.通过Executors中的静态方法创建: public static ExecutorService new ...
- [django]梳理drf知识点
要实现的功能 idc_list/ get 列出所有 post 创建一个idc idc_detail/1/ get 获取一个idc put 修改一个idc delete 删除一个idc 一般url是这样 ...