On 23/12/05, David Xiao
For example I have path "C:\Temp\abcd\hello\", I wish to iterate to get C: , C:\Temp , C:\Temp\abcd , C:\Temp\abcd\hello .
I think you have the choice of either using branch_path repeatedly or using the exposed iterators. using the iterators, I would guess something similar to the following: path my_path( "C:\Temp\abcd\hello\", native ); assert( my_path.has_root_path() ); path now_path = my_path.root_path(); my_path = my_path.relative_path(); for ( path::iterator b = my_path.begin(); b != my_path.end(); ++b ) { now_path /= *b; std::cout << now_path.native_directory_string() << std::endl; } That of course assumes they're all directories -- you might want to choose native_directory_string or native_file_string based on is_directory. You might also look at how http://boost.org/libs/filesystem/doc/convenience.htm#create_directories is implemented, since it presumably has to do something similar internally. - Scott