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 8741683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:21:37+00:00 2026-06-13T11:21:37+00:00

I have a list of files which their name indicate when they are created.

  • 0

I have a list of files which their name indicate when they are created. Their name have the convention “yyyyMMdd.txt”. yyyy are years, MM are months and dd are dates. I am trying to write a function that can open only those files which were created within a time range in C#.

For example: I want to access to files which were created between 10/20/2012 to 10/25/2012. Any file that has its name falls in that time interval will be accessed.

The function signature is something similar to this: void dosomething (DateTime from, DateTime to)

Is there any good way to complete this function? Any suggestions would be appreciated.

  • 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-13T11:21:38+00:00Added an answer on June 13, 2026 at 11:21 am

    The filename format you describe is lexical (ordered) so you can use the following approach:

    1. convert the DateTime inputs to the same format as your file names (yyyyMMdd)

    2. read the file names and convert them to integers like 20121026

    3. convert your inputs to integers the same way

    4. now use ordinary greater than >, less than < tests to determine if the date is in the range.

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

Sidebar

Related Questions

I have list of files which contain particular patterns, but those files have been
I have a list of files of which I want to add a line
I have two files which both contain a list of words. Is there an
I have a long list of files and file extensions which I would like
I currently have a script which allows me to output the list of files
I have the following code which utilises Guava's Files.readLines() method: List<String> strings = Lists.newArrayList();
Let's imagine that I have list of files at host1 find /path/to -name *.jpg
I have a directory which contains several files, many of which has non-english name.
I have two datatables, one which lists foldes, and another which list's files within
I have a JTree which contains file/directory, i want to get a list which

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.