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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:52:51+00:00 2026-06-12T08:52:51+00:00

I need to display files between 2 dates (e-g. dates 23-sep-2012 to 30-sep-2012) in

  • 0

I need to display files between 2 dates (e-g. dates 23-sep-2012 to 30-sep-2012) in a folder using a batch script.

There are approximately a half million files in the folder.

How can I do this?

  • 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-12T08:52:52+00:00Added an answer on June 12, 2026 at 8:52 am

    Working with file timestamps is a pain in batch. The easiest solution is to use WMIC.

    Here is a simple script that will do what you want. It can easily be modified to use CreationDate instead of LastModified date. You can also add and subtract additional columns to the output. Type wmic datafile get /? to get a list of available columns (remove the spaces from the names). The output can be piped to SORT if you want the results sorted by date.

    The dates must be specified in YYYYMMDD format.

    @echo off
    :listFilesBetweenDates  Path  StartDate  EndDate
    ::
    ::  List files found in directory Path with last modified date between
    ::  StartDate and EndDate
    ::
    ::  path = Directory to list. Use . for current directory
    ::
    ::  startDate = YYYYMMDD format
    ::
    ::  endDate = YYYYMMDD format
    ::
    setlocal
    set "drive=%~d1"
    set "folder=%~pnx1\"
    set /a "start=%~2, end=%~3+1"
    wmic datafile where "drive='%drive%' and path='%folder:\=\\%' and lastModified>='%start%' and lastModified<'%end%'" get lastModified, name
    

    Sample usage – list files in current directory between 07-SEP-2012 and 17-SEP-2012

    D:\test>listFilesBetweenDates . 20120907 20120917
    LastModified               Name
    20120917155412.408435-240  d:\test\idlist.txt
    20120910160033.573531-240  d:\test\input.txt
    20120907180451.138275-240  d:\test\myurls.txt
    20120911115129.949457-240  d:\test\replace.bat
    20120917155853.541247-240  d:\test\temp1.txt
    20120917162208.635197-240  d:\test\temp2.txt
    20120917162217.595287-240  d:\test\temp3.txt
    20120911141557.105798-240  d:\test\test,2.txt
    20120910160622.664376-240  d:\test\test.vbs
    20120907161948.016121-240  d:\test\test3.bat
    20120910153717.558353-240  d:\test\test3.txt
    

    Sample usage: List files in temp directory between 26-SEP-2012 and 27-SEP-2012 sorted by last modified date in ascending order

    D:\test>listFilesBetweenDates "%temp%" 20100926 20120927 | sort
    
    20120926085420.368034-240  d:\users\xxxxxx\temp\~df8a4e7af0245496b2.tmp
    20120926085422.630049-240  d:\users\xxxxxx\temp\fxsapidebuglogfile.txt
    20120926085433.781136-240  d:\users\xxxxxx\temp\sof8436.tmp
    20120926085436.861167-240  d:\users\xxxxxx\temp\cvr941b.tmp.cvr
    20120926103842.351663-240  d:\users\xxxxxx\temp\~dfe34cb61c66a1dcd7.tmp
    20120926181118.453780-240  d:\users\xxxxxx\temp\~dfd0009f24c8c5eb31.tmp
    20120927100903.382946-240  d:\users\xxxxxx\temp\~df559b9f2b2763ac3f.tmp
    20120927100915.210126-240  d:\users\xxxxxx\temp\cvr3d51.tmp.cvr
    20120927100918.680196-240  d:\users\xxxxxx\temp\sof47cf.tmp
    20120927144827.689200-240  d:\users\xxxxxx\temp\tmpdbc8.tmp
    20120927144828.169209-240  d:\users\xxxxxx\temp\tmpddad.tmp
    20120927184908.066005-240  d:\users\xxxxxx\temp\~df401234aa9008c5e1.tmp
    LastModified               Name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to display favicon.ico files fetched from arbitrary Web Sites as a BitmapImage
I need to display the names of the files in a specified directory. How
I need to display a graph of a sound file - i.e. a wave
I need a program that reads from multiple files and displays a report based
i am developing one application with map view i need display the weather depends
I need to display image and one button on fancybox popup but I can't
I need to display short description like label and near it data associated with
I need to display all the employees in one webpart. I created the gridview
I need to display a multiply sign (×) in a modal being created by
I need to display the parent from the first Element of input.xml Also 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.