java simple check whether a file or directory.
JAVA File or Directory check Simple
2023-09-27 14:28:06 时间
Ref: check whether a file or directory
First, make sure the path exists by using:
new File(path).exists();
Then check whether it a directory using:
1 new File(path).isDirectory();
Similary,check whether it a file by using:
1 new File(path).isFile();
相关文章
- java注解Annotation的使用实例
- Java File文件操作 创建文件目录,删除文件目录
- Java 类(class)
- Java 流(Stream)、文件(File)和IO
- Java环境配置
- 【转】java对File.listFiles()排序
- java语音转文字
- Java IO: File
- java.lang.ClassFormatError: Unknown constant tag 0 in class file
- list of Java class file format major version numbers?
- 2022年最新Java面试真题总结!
- Java Jvm运行机制原理
- Java 流(Stream)、文件(File)和IO
- 《Java EE 7精粹》—— 3.6 HTTP GET
- java中File类详解
- Spring文件上传出错:java.lang.ClassCastException: org.apache.catalina.connector.Request
- JMeter学习-027-JMeter参数文件(脚本分发)路径问题:jmeter.threads.JMeterThread: Test failed! java.lang.IllegalArgumentException: File distributed.csv must exist and be readable解决方法
- 关于Java的File类、字节流和字符流
- Java之File类详解
- JAVA 复习笔记(一)公共类在一个file下只能有一个
- Java虚拟机(四)垃圾收集算法
- Java泛型的协变
- 曹工杂谈:Java 类加载还会死锁?这是什么情况?
- Java多线程-线程的优先级(priority)以及守护线程(daemon)
- java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
- Java NIO —— 用 Path 取代 File