List files with todays

March 17, 2009 at 04:13:44
Specs: Windows XP
I need to write small program which will me the list of files for todays date.

See More: List files with todays

Report •


#1
March 17, 2009 at 05:28:45
%dl% should be you drive letter and %mdy% should be the date.

@set dl=c
@set mdy=3-17-09
@(
xcopy %dl%:\ %dl%:\fake /l /i /f /d:%mdy%
for /f "delims=" %%a in ('dir %dl%:\ /ad/b') do @xcopy "%dl%:\%%a" %dl%:\fake /l /i /s /f /d:%mdy%
)|for /f "delims=^>" %%b in ('find "\"') do @(
set fn=%%b
call set fn="%%fn:~0,-3%%"
call echo %%fn%%
)
pause

You can figure out how to get the date into it and the like.....


Report •

#2
March 17, 2009 at 06:42:58
the following logic only works for today date:

C:\batch>echo %date%
Tue 03/17/2009

C:\batch>echo %date:~-10%
03/17/2009

C:\batch>cd.>test.txt & for %a in (test.txt) do @echo %~ta
03/17/2009 08:37 PM


Report •

#3
March 18, 2009 at 09:47:43
@echo off > %temp%\# & setLocal EnableDelayedExpansion

for /f "tokens=* delims= " %%i in ("%temp%\#") do (
for /f "tokens=1 delims= " %%d in ("%%~Ti") do (
set TD=%%d
echo today is !TD!
)
)

echo.
echo today's files are:
echo.

for /f "tokens=* delims= " %%a in ('dir/b/a-d') do (
for /f "tokens=1 delims= " %%x in ("%%~Ta") do (
if %%x equ !TD! echo %%a
)
)


=====================================
If at first you don't succeed, you're about average.

M2


Report •

Related Solutions


Ask Question