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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:07:55+00:00 2026-05-18T04:07:55+00:00

I need a batch file that monitors additions to my Downloads folder, but only

  • 0

I need a batch file that monitors additions to my Downloads folder, but only new additions. Something like this:

:START  

NumOldFiles = GetNumberOfFilesOld  

Delay_30_Seconds  

NumNewFiles = GetNumberOfFilesNew  

if(NumFilesOld < NumFilesNew)  
  run_another_batch_file_I_wrote
  goto START
else
  goto START

I do not want to count subfolders, just the folders and files in the directory.
I have been looking at this:
dir "C:\folder" /b/a |find /v /c "::"
but I don’t know how to store this value and test it as < or >.
Maybe there is a better way to do this, but I can’t think of one right now. Maybe maintain a list and if the new list has a new file run the batch script, replace the old list with the new list, I’m not really sure how to go about 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-05-18T04:07:56+00:00Added an answer on May 18, 2026 at 4:07 am

    Answer 1:

    The following snippet should get you going in the right direction. It uses dir /b to get a raw list of files and uses fc (file compare) to check for differences between each execution of the check.

    You could use the Task Scheduler to launch this batch file once every x minutes:

    @echo off
    if not exist c:\OldDir.txt echo. > c:\OldDir.txt
    dir /b "d:\My Folder" > c:\NewDir.txt
    set equal=no
    fc c:\OldDir.txt c:\NewDir.txt | find /i "no differences" > nul && set
    equal=yes
    copy /y c:\Newdir.txt c:\OldDir.txt > nul
    if %equal%==yes goto :eof
    rem Your batch file lines go here
    

    Answer 2:

    I have always liked a library of batch functions by Ritchie Lawrence. One of those functions is called GetDirStats.

    The GetDirStats function returns the number of files, subdirectories and total size of a specified directory. Might be handy for future reference. Although it’s only tested on NT4/2000/XP/2003.
    Just change compact/s to compact to not scan subfolders.

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

Sidebar

Related Questions

I need to create a batch file that changes path to a particular folder
I have a batch file that creates a scheduled task using schtasks like this:
I have a for loop in a batch file that looks like this: for
I wanna create a batch file that could do something to all folder in
I need to find the folder name of the batch file that I am
I need a batch file that will search for the string Gen_1_X. When the
I need to create a batch file that reads a file with one line
I need to create a batch file that will take the latest of my
Here I have 2 requirements: Need a batch file to start a process on
I need a batch file that will recursively remove all directories with a certain

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.