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

  • SEARCH
  • Home
  • 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 3437062
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:01:09+00:00 2026-05-18T08:01:09+00:00

I am using the Boost::FileSystem library with C++ running under Linux platform and I

  • 0

I am using the Boost::FileSystem library with C++ running under Linux platform and I have a question following:

I would like to have a list of files which are modified older than a given date time. I don’t know whether the boost::FileSystem offer such a method as:

vector<string> listFiles = boost::FileSystem::getFiles("\directory", "01/01/2010 12:00:00");

If yes, could you please provide sample code?

  • 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-05-18T08:01:10+00:00Added an answer on May 18, 2026 at 8:01 am

    Boost::filesystem doesn’t offer a function exactly like that. But you can use this:

    http://www.boost.org/doc/libs/1_45_0/libs/filesystem/v3/doc/reference.html#last_write_time

    as a basis to write your own. Here is some sample code using last_write_time:

    #include <boost/filesystem/operations.hpp>
    #include <ctime>
    #include <iostream>
    
    int main( int argc , char *argv[ ] ) {
       if ( argc != 2 ) {
          std::cerr << "Error! Syntax: moditime <filename>!\n" ;
          return 1 ;
       }
       boost::filesystem::path p( argv[ 1 ] ) ;
       if ( boost::filesystem::exists( p ) ) {
          std::time_t t = boost::filesystem::last_write_time( p ) ;
          std::cout << "On " << std::ctime( &t ) << " the file " << argv[ 1 ] 
         << " was modified the last time!\n" ;
          std::cout << "Setting the modification time to now:\n" ;
          std::time_t n = std::time( 0 ) ;
          boost::filesystem::last_write_time( p , n ) ; 
          t = boost::filesystem::last_write_time( p ) ;
          std::cout << "Now the modification time is " << std::ctime( &t ) << std::endl ;
          return 0 ;
       } else {
          std::cout << "Could not find file " << argv[ 1 ] << '\n' ;
          return 2 ;
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using boost::filesystem to copy a directory recursively. I would like to exclude
I have just started using Boost 1.36. These libraries would be very useful in
I'm using boost::asio, and I have code like this: void CServer::Start(int port) { tcp::acceptor
I'm using boost filesystem to replace windows C++ functions like CopyFile and MoveFile to
I have code using boost to list directory contents, iterate through each file, and
I'm trying to use boost::filesystem to copy files and folders (just like a standard
We are using boost::filesystem in our application. I have a 'full' path that is
When using Boost Filesystem's createdirectory (and createdirectories) function in the following example, / is
I'm using boost::filesystem for cross-platform path manipulation, but this breaks down when calls need
I have been using Boost (the header only library part) for sometime now. I

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.