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 ...
随机推荐
- 【python基础】文件操作
文件操作目录 一 .文件操作 二 .打开文件的模式 三 .操作文件的方法 四 .文件内光标移动 五. 文件的修改 一.文件操作介绍 计算机系统分为:计算机硬件,操作系统,应用程序三部分. 我们用pyt ...
- python练习题-day6
1.老男孩好声⾳选秀⼤赛评委在打分的时候呢, 可以进⾏输入. 假设, 老男孩有10个评委. 让10个评委进⾏打分, 要求, 分数必须⼤于5分, ⼩于10分. pingwei=["a" ...
- iis子站点
在iis已有的站点下可以继续添加”应用程序”,就构成子站点:需要访问子站点app下的程序,只想在controller/action前,加个app就行,即app/controller/action 这样 ...
- pycharm快捷键帮助文档Keymap Reference
前面我们已经安装了pycharm,为了提升效率,我们一般会用到快捷键操作,pycharm有哪些快捷键呢?Pycharm中打开Help->Keymap Reference可查看默认快捷键帮助文档, ...
- python安装提示ImportError: No module named web
今天在开发一个项目时出现错误,重新安装了一下python和yum,然后面板就无法启动了,提示需要安装web依赖,但是具体是哪个web源呢,pip install web不行 Traceback (mo ...
- Tensorflow安装记录
一.安装Ubantu环境 下载ios 网址:http://cn.ubuntu.com/download/ 2.配合虚拟机进行安装环境 虚拟机直接百度下载即可 虚拟机采用 具体安装,虚拟机百度中很多记录 ...
- UnicodeDecodeError异常
UnicodeDecodeError异常 UnicodeDecodeError: 'utf8' codec can't decode byte 0xb2 in position 154: invali ...
- UDP网络通信
网络概念 一.目的 二.IP地址 三.端口 一.目的 目的 : 主要用于让两个用户端的服务器或者客户端,可以实现资源共享和信息传递 二.IP地址 1.作用 : 计算机网络中一台计算机的标识 2.种类 ...
- sap 提供服务
1: https://blog.csdn.net/stone0823/article/details/81661261?utm_source=blogxgwz1 https://blog.csdn.n ...
- Python Singleton模式
注意:在重写__new__方法时,object.__new__(cls)不能传参数 #!/usr/bin/env python # -*- coding: utf-8 -*- class Single ...