In this post we will see how to read file using Scanner in Java. Scanner is a part of the java.util package. We will use Scanner.nextLine() to read the file How to read file using S
How to Copy Directory in Java Recursively
In this post we will see How to Copy Directory in Java Recursively. I have a directory “kscodes\source” and it has following folders and files inside it. Lets see an example which will
How to Delete Directory in Java
In this post we will see How to Delete Directory in Java. We will use the File.delete() method. But to use this method we need the directory to be empty. I have an directory “kscodes” a
How to Decompress Files in Java – Zip Format
In this post we will see how to decompress files in java using ZIP format. Java provides a complete package java.util.zip to perform compression/decompression. Steps to decompress files in ZIP form
How to Compress Files in Java – Zip Format
In this post we will see how to compress files in java using ZIP format. Java provides a complete package java.util.zip to perform compression/decompression. Steps to compress files in ZIP format 1
How to list Files in a Directory in java
Using the java.io.File api we will see how to list files in a directory in java. File.list() method returns array of String containing names of files
How to check if File is Directory in Java
We have 2 ways to check if file is Directory in java 1. java.io.File API’s isDirectory() method 2. java.nio.file.Files API’s [c
How to check if file is Hidden in java
To check if file is hidden in java, we use java.io.File API’s isHidden() method. In this post we will see example of how we use isHidden method i
How to get Creation Time of File in Java
To get creation time of file in java we can use the java.nio.file.Files API’s readAttributes() method. Example : Get Creation Time of File in Java [crayon-650
How to get File size in java
We can get File size in java by 2 methods. 1. java.io.File API’s length() method 2. java.nio.file.Files API’s [crayon-650d