Created
April 16, 2025 14:36
-
-
Save aspose-com-gists/88bf4be14a680581d7644d341789c065 to your computer and use it in GitHub Desktop.
Create CPIO file in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create CPIO file | |
import com.aspose.zip.CpioArchive; | |
public class main { | |
public static void main(String[] args) { | |
// Define the path for the working directory. | |
String dataDir = "/files/data/"; | |
String outDir = "/Desktop/"; | |
// Initialize an object of the CpioArchive class. | |
try (CpioArchive archive = new CpioArchive()) { | |
// The createEntries method will add to the archive all the files and directories recursively in the directory given. | |
archive.createEntries(dataDir); | |
// Invoke the save method to save archive to the destination file provided. | |
archive.save(outDir + "archive.cpio"); | |
} | |
System.out.println("Successfully Compressed Files"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment