Reading files in .rar archive without unzipping
Mostra commenti meno recenti
I am trying to get a listing of the files contained in a .rar (unencrypted) archive without unzipping the archive each time I want to run the script. There is a method to get the files listed in a zip archive, but since I'm using this for storage purposes, I am saving as a .rar for better compression.
This post describes a procedure by which one can obtain a list of the files inside a zip archive, but I can't get it to work with a rar archive. Any help would be great. Thanks.
Risposte (1)
Walter Roberson
il 28 Lug 2022
0 voti
For the task of getting the list of files in a rar, without extracting them, https://stackoverflow.com/questions/561107/rar-archives-with-java
(RAR license is restrictive about doing extraction.)
8 Commenti
Publius
il 29 Lug 2022
Walter Roberson
il 29 Lug 2022
java_filename = java.lang.String('PathToRarFileGoesHere.rar');
rar_file = RARFile(java_filename);
entries = rar_file.entries();
count = 0;
while (entries.hasMoreElements())
entry = entries.nextElement();
entry_name = entry.getName().toCharArray';
count = count + 1;
fprintf('#%d: %s\n', count, entry_name);
end
Publius
il 31 Lug 2022
Walter Roberson
il 31 Lug 2022
I think you just add the directory in javaaddpath, not the .java file itself.
Publius
il 31 Lug 2022
Walter Roberson
il 3 Ago 2022
Hmmm, the documentation at https://github.com/radarsh/raroscope hints that it needs to be compiled into a .jar -- see the "Gradle" part
Publius
il 3 Ago 2022
Categorie
Scopri di più su Call Java from MATLAB in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!