I just wanna try it again here, maybe somebody will shop up who knows where is the problem as I unfortunately couldn't fix it with degski (but still, thank you for your time :)). His example (can be found below) doesn't work on my system. The problem is I can't start iteration from the drive root (for example E:\), because it will iterate only the directory above (E:\projects\boost\build) the directory that the executable is located in (the executable is located in E:\projects\boost\build\Debug). What is weird that if I move the executable to the different directory (let's say C:\Users\USER_NAME\Downloads) it will still iterate only the build directory. I tried to play with Visual Studio -> PROJECT_NAME -> Properties -> Debugging -> Working Directory, but without a success. According to degski he has the value of this entry set to $(ProjectDir) which is the same value as mine. Thank you.

On 11/18/2018 9:04 AM, degski wrote:
On Sun, 18 Nov 2018 at 05:31, Richard Závodný via Boost-users <boost-users@lists.boost.org> wrote:


---------- Forwarded message ---------
From: Richard Závodný <zavodnyrichard@gmail.com>
Date: Sat, Nov 17, 2018, 3:59 PM
Subject: Boost::Filesystem - How to iterate, through the whole drive
To: <boost-users@lists.boost.org>


Hey guys, I need iterate over all directories from starting path. If I start iterating from C:\some-dir it works very well, however if I try to iterate from C:\, it doesn't work. How can iterate through the whole drive? Thank you.


Code is here: https://pastebin.com/mpsKJxH2. The problem I experience is commented right in the code section (line 1, 13 and 25).


This works for me, either with boost-1.68 (not that I think that matters) or the STL-VC-15.9.1 (/std:c++17):

#include <iostream>
#include <boost/filesystem.hpp>

namespace fs = boost::filesystem;

int main ( ) {
    for ( auto & p : fs::recursive_directory_iterator ( "d:\\" ) ) {
        std::cout << p.path ( ) << '\n';
    }
}

Note that: "The iteration order is unspecified, except that each directory entry is visited only once."

degski
--
If something cannot go on forever, it will stop" - Herbert Stein