Reputation: 193
I have about 6000 .txt files to read. There are many folders, each containing many sub-folders, which again contain many sub-folders and at the end of every sub-folder there is a text file. the text file contains few numbers which I have to read. My issue is recursively going through the folders and sub-folders.
I am able to do this in Python, but not in C++.
Can someone help me with C++ (preferably without Boost)
Upvotes: 1
Views: 659
Reputation: 764
I assume, from your mention of Boost, that you are aware of boost::filesystem, but are looking for an alternative. I'm not aware of any that are portable. A portable file system library is planned for the C++17 Standard Library, but it is based on boost::filesystem. On POSIX-compliant OSes, you could perhaps use the API functions declared in the dirent.h POSIX (straight C) header.
Upvotes: 0
Reputation: 4493
Unfortunately, best available thing is boost::filesystem::recursive_directory_iterator or, in case of fresh compiler - std::experimental::filesystem::recursive_directory_iterator
Examples are available in links provided
Upvotes: 4