-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
36 lines (26 loc) · 1.27 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "SevenZ.h"
#include <filesystem>
#include <iostream>
namespace fs = std::filesystem;
int main() {
fs::path input_file("/home/gabriel/IGN Files/SCAN25_3-1_TOUR_TIFF_LAMB93_D014_2022-12-01.7z");
// fs::path input_file("../lzma2301.7z");
fs::path out_dir("./test/");
if (exists(out_dir)) {
remove_all(out_dir);
}
create_directory(out_dir);
SevenZArchive sevenZArchive = SevenZArchive(input_file);
std::cout << "Nb Files : " << sevenZArchive.nbFiles() << std::endl;
std::for_each(sevenZArchive.begin(), sevenZArchive.end(),
[&sevenZArchive, &out_dir](const SevenZFileEntry &fileEntry) {
if (fileEntry.fileName.extension().string() == ".tif") {
std::tm *ltm = std::localtime(&fileEntry.creationTime);
std::cout << "Name : " << fileEntry.fileName << std::endl
<< "Size : " << fileEntry.fileSize << std::endl
<< "Time : " << std::put_time(ltm, "%c %Z") << std::endl << std::endl;
sevenZArchive.extractInFile(fileEntry, out_dir / fileEntry.fileName.filename());
}
});
return 0;
}