Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8993599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:13:39+00:00 2026-06-15T23:13:39+00:00

I am running through a directory containing multiple sub-directories. I am using recursive_directory_iterator. I

  • 0

I am running through a directory containing multiple sub-directories. I am using recursive_directory_iterator. I have directory asr->collections->(multiple directories and couple of text files)

#include <iostream>
#include <filesystem>
#include <conio.h>

using namespace std::tr2::sys;

int main () {
std::string path_;
std::cout << " Enter the path ";
std::cin >> path_;

auto dir_path = path(path_);

for (auto it = directory_iterator(dir_path); it != directory_iterator(); ++it)
{
    const auto& file = it->path();
    std::cout << " path : " << file << std::endl;

    if (is_directory (status(it->path()))) 
        std::cout << " It is a directory. " << std::endl;
    else 
        std::cout << " It is not a directory. " << std::endl;
}
_getch();
return 0;
}

I know I had posted this earlier. It was a silly mistake, I changed it. But it is still bugy. The issue I am having is the is-directory returns false for everything.
Am I using it wrong. I have linked the MSDN URL below.

I installed boost and ran the code. It worked !
Boost Source

#include <iostream>
#include <boost\filesystem.hpp>
#include <conio.h>

using namespace boost::filesystem;

int main () {
std::string path_;
std::cout << " Enter the path ";
std::cin >> path_;

auto dir_path = path(path_);

for (auto it = directory_iterator(dir_path); it != directory_iterator(); ++it)
{
    const auto& file = it->path();
    std::cout << " path : " << file << std::endl;

    if (is_directory (status(it->path()))) 
        std::cout << " It is a directory. " << std::endl;
    else 
        std::cout << " It is not a directory. " << std::endl;
}
_getch();
return 0;
}

http://msdn.microsoft.com/en-us/library/hh874754.aspx

Also, can I use the boost filesystem documentation be used as a tutorial for this, since there is no good documentation as to what is what and how to use it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:13:40+00:00Added an answer on June 15, 2026 at 11:13 pm

    Ok, the issue was fixed after I updated the Visual Studio with first major update.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a directory with a lot of sub directories. I am running through
I have a root-ish directory containing multiple subdirectories, all of which contain a file
Using Java: I am reading a directory containing files with Greek Names. But when
string[] files = Directory.GetFiles(tb_dir.Text, tb_filter.Text, SearchOption.AllDirectories); I'm trying to search through a directory and
So I'm running through a list of things and have code that creates an
I am currently testing out using OSGi. I am running this through Eclipse. I
I have a problem running a Ruby on Rails application using Passenger. My application
I've just installed Zend Framework and am running through a tutorial, but have hit
I'm going through the basic django tutorial and I'm running the server using python
I'm having an array $bundle that stores filenames and directory names. I'm running through

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.