Showing posts with label folder subfolder. Show all posts
Showing posts with label folder subfolder. Show all posts

Friday, January 21, 2022

Read the files inside directory(folder) and subdirectory(sub folder) using Java 8+

In this tutorial, we are going to learn how we can read all the files and specific files inside the directory and subdirectory. Let's create a sample class FileReader.java Read all the directory subdirectory and files: public static void main(String[] args) { String directoryPath = "path_to_directory"; try { List<String> allFiles = listFiles(directoryPath); ...
Share:

Thursday, January 20, 2022

How to unzip the zip file and zip the folder in Java

In this tutorial, we are going to learn how to zip the given folder and unzip the zip file using Java. Zip the folder or directory: Let's create a java class ZipUnzip.java and create the main method. public static void main(String[] args) { String folderInputPath = "path/of/folder/to/zip"; String outputPath = "output/path/compressed.zip"; try { zip(folderInputPath,...
Share:

Saturday, January 8, 2022

How to unzip all the zip files present in folder and sub folders using java

In this tutorial, we are going to learn how we can unzip all the zip files present in the folder and sub-folders.Steps to follow: loop through the folder and subfolders and get the files inside it.Check if the file is a zip file or notIf the file is a zip file then extract that file in the corresponding folder Create a java class called UnzipFolderFile.java. First, let's implement the method which...
Share: