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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:45:32+00:00 2026-06-15T19:45:32+00:00

I need some help making a service application batch file. In short, the application

  • 0

I need some help making a service application batch file.

In short, the application checks if there are any new files in a folder, if so it writes to a log file (Results.txt).

The problem is that if there are no “results” in the folder in 24 hours there is usually something wrong. (Either the service has crashed or there is a network problem.) So I need to write a batch script to check if the Results.txt file has been altered in the last 24 hours.

My plan is to have a batch file run every 24 hours that checks the md5sum of Results.txt to see if it has changed. However, I have no idea how to go about this. In pseudocode, it would look like this:

if not exist old.txt echo. > old.txt & fc "md5.txt" "old.txt"
%md5sum% Results.txt > md5.txt
set equal=no
if md5.txt==old.txt set equal=yes
if equal=no echo No results found in 24 hours >> log.txt
  • 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-15T19:45:34+00:00Added an answer on June 15, 2026 at 7:45 pm

    How about going simple? No fancy MD5, just the output of the dir command! This works because the dir command output will be exactly the same no matter when it is run if nothing has changed in the directory it is checking.

    For Help and More Options see:

    dir /?
    fc /?
    

    Example:

    @echo off
    if not exist old_fingerprint.txt echo. > old_fingerprint.txt
    :: List the directory information, recursive, last write timestamps, 4 digit date
    dir /n /s /t:w /4 > new_fingerprint.txt
    :: Check out fc /? for all of the comparison options.
    fc new_fingerprint.txt old_fingerprint.txt
    :: fc sets errorlevel to 0 when the files match and not 0 when the files do not match.
    if %ErrorLevel% NEQ 0 echo.No results found in 24 hours>> log.txt
    

    If you want to hide all the output of the batch script just throw in a > nul behind the fc line.

    Update:
    In light of the new information provided.

    So you just need to check the last write time stamp of the Results.txt file. As long as you do not write to the file when there has been no changes and update the time stamp.

    Or even better yet, if all you care about is whether or not a folder has had any activity inside of it, just check that folder’s ‘last write’ time stamp. If the time stamp is older than 24 hours you can process your no results found in 24 hours.

    Use the /t:w option with the dir command and you can parse the time stamp that you need.

    TLDR: KISS

    Update 2:

    Here is an example script showing how to get a pure breakdown of the directory information.

    @echo off
    setlocal
    
    for /f "usebackq tokens=1,2,3,4,*" %%A in (`dir /a:d /l /n /t:w /4`) do (
        echo.
        echo.Date = %%A
        for /f "usebackq tokens=1,2,3 delims=/" %%X in ('%%A') do (
            echo.Month = %%X
            echo.Day = %%Y
            echo.Year = %%Z
        )
        echo.Time = %%B
        for /f "usebackq tokens=1,2 delims=:" %%X in ('%%B') do (
            echo.Hour = %%X
            echo.Minute = %%Y
        )
        echo.Meridiem = %%C
        echo.Type Raw = %%D
        for /f "usebackq tokens=1 delims=<>" %%X in ('%%D') do (
            echo.Type = %%X
        )
        echo.Name = %%E
        echo.
    )
    
    endlocal
    

    Answer:
    Here is a script illustrating an easy way to get and compare the time stamps. Setup a scheduled task to run this script every 24 hours and if the time stamp has not changed since the last run, it will print out a message to the log file.

    setlocal enabledelayedexpansion
    
    for /f "usebackq tokens=1,2,3,4,*" %%A in (`dir /a:d /l /n /t:w /4`) do (
        if /i "%%~E"=="Folder" (
            if exist "LastTimeStamp.txt" find /c /i "%%A %%B %%C %%E" LastTimeStamp.txt > nul
            if !ErrorLevel! EQU 0 echo.The folder time stamp has not changed since last checked. >> log.txt
            echo.%%A %%B %%C %%E > LastTimeStamp.txt
        )
    )
    
    endlocal
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to JavaScript and I need some help. I am making a
I need some help with an app i'm making using MapKit I'm struggling with
I need some help making a linq query that will select a list of
I need some help with making the following code work properly: $('#entry').keydown(function(e) { alert(e.keyCode);
I need some help with making a tiled map, I'm just getting a white
I need some help making this program for class. We are working with g++
Ok this is really making me crazy and I need some help. I have
I am new to programming with Objective-C and Stackoverflow, and I need some help.
I need some help regarding making a form using PHP, MySQL, and jQuery. Here
I am making NO headway in writing a regular expression and need some help.

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.