I have a folder and subfolder which contain many HTML files. I want to store all the html file paths to an array. I am using C++ and ubuntu.
I know a terminal command - find . -name *.html
which gives me all the html file paths.
I want to use these paths to create PDF of these HTML files using WKHTMLTOPDF
and threading. How to store these paths and use it?
Asked
Active
Viewed 127 times
0

Shashwat Kumar
- 5,159
- 2
- 30
- 66

Ankit Jain
- 603
- 2
- 6
- 17
-
I wouldn't use an external command to get the list of paths to your html paths but rather stick with c++. See [link](http://stackoverflow.com/questions/612097/how-can-i-get-the-list-of-files-in-a-directory-using-c-or-c) – Harry Mar 28 '17 at 07:48
1 Answers
0
You could brute-force it by using std::system
http://en.cppreference.com/w/cpp/utility/program/system
to execute your find command and use the output in a C++ program. Or read up on file system traversal in Steven's APUE ('Advanced Programming in the Unix Environment) and do it yourself. Begin with man 3 stat
.

Erik Alapää
- 2,585
- 1
- 14
- 25
-
Thanks for the help. But what if i have lakhs of html files. It will store first on text file and then reading text file would not be a good solution i think. – Ankit Jain Mar 29 '17 at 10:21