Below command gives me count of files in a folder, I want the count of today's created/modified files in this folder, TIA.
set LocalFolder=D:\Myfolder
SET file_to_be_copied_Cnt=0
for %%o IN (%LocalFolder%/*.*) DO (
SET /A file_to_be_copied_Cnt=file_to_be_copied_Cnt + 1
)
echo %file_to_be_copied_Cnt%
If you're not actually copying the files, just counting them, you could probably use this:
If you're also copying the files and need to know the number copied then you could probably use this:
What about this:
Or this if you want to include sub-directories:
How it works:
forfiles
returns a_
character for each file modified today (/D +0
means modified on date of today or newer);if
query avoids directories to be regarded/counted;find
counts (/C
) the amount of returned lines containing_
characters;To assign the resulting number to a variable, use a
for /F
lop:Or:
Note the escaped pipe
^|
.