Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I need a batch application that would check a folder, find the files that has been modified after the last batch run and display the modified file names in a text file. Please somebody hellp me on this.

You may use xcopy /m
That is, your displaymodified.bat would look something like:
md c:\tempdir
xcopy /m C:\sourceDir C:\tempdir > c:\Dirlist.txt
del /q c:\tempdir
After copying, it resets archive attributes.
So when invoked second time, only the files with archive attribute set is copied.
c:\Dirlist.txt will contain the list of files copied.--
Holla.

I like Holla's suggestion. I can offer an optimization. There's no need to do the copying, but just use dir /aa to list all files with the archive attribute set, and attrib -a to turn off the archive attribute. Then there's no need to create & delete a temporary folder either.

@echo off > modfile
setLocal EnableDelayedExpansionfor /f "tokens=2 delims= " %%a in ('attrib *.* ^| findstr /b "A"') do (
echo %%a >> modfile
)attrib -a -s -h -r *.* > nul
=====================================
If at first you don't succeed, you're about average.M2

Hi all,
Thanks for your your help.Now i have a different problem.
When i build the files there are few file that will be built everytime. so how do i identified onlythe changed ones. Is there a way??

klint,
I was thinking hard with xcopy /m, /l, etc.
Forgot about dir /a* .
This often happens with me, forget some obvious solutions and use a long solution where a diminutive :-) one would do.
Is it only me?
Is it more in batch programming?Aarya,
Before the build, run
attrib -a *.*
and after the build list the dir withdir /aa
this would give you the list of files that were newly created.--
Holla.

![]() |
Batch File To Remove Cert...
|
Is this a harmfull batch ...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |