Rust Requires Chilkat v11.0.0+
Rust
List Files in a .zip
See more Zip Examples
How to list files within a .zipChilkat Rust Downloads
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let zip = chilkat::Zip::new();
if zip.open_zip("a.zip").is_err() {
println!("{}", zip.last_error_text());
return;
}
// Get the number of files and directories in the .zip
let n = zip.num_entries();
let entry = chilkat::ZipEntry::new();
let mut i = 0;
while i < n {
let _ = zip.entry_at(i, &entry);
if !entry.is_directory() {
// (the filename may include a path)
println!("{}", entry.file_name());
}
i = i + 1;
}