Used "GetDate" Function From -- >
http://www.commandline.co.uk/lib/treeview/index.php
and some of my old scripts
batch script to display the files created in the last 30 days ?
Will Search All Fixed Hard Drives !
Code:
@echo off
setlocal
Set daycount=30
call :^GDP
call :^SD
set D=%yy%%mm%%dd%
for /f "tokens=1 delims=\" %%d in ('fsutil fsinfo drives ^| find "\"') do (
fsutil fsinfo drivetype %%d | findstr /i "Fixed" >nul
if not errorlevel 1 (
call :^S %%d
)
)
goto :EOF
:^S
pushd %*\
for /f "tokens=*" %%a in ('dir /b /a-d /s 2^>NUL') do call :^P "%%~dpnxa" %%~ta
goto :EOF
:^P
call :^GDP %~2
if /i "%yy%%mm%%dd%" GEQ "%D%" echo "%~1"
goto :EOF
:^GDP
if "%date%A" LSS "A" (set toks=1-3) else (set toks=2-4)
for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('echo:^|date') do (
for /f "tokens=%toks% delims=.-/ " %%d in ('date/t') do (
set %%a=%%d
set %%b=%%e
set %%c=%%f
set toks=
)
)
if %yy% LSS 100 set yy=20%yy%
goto :EOF
:^SD
:: strip leading zeros from possible octals
set /a mm=1%mm%-100, dd=1%dd%-100
if /i %daycount%==0 goto ^DS
set /a daycount-=1
:^CD
set /A dd-=1
if %dd% GTR 0 goto DONE
:: today is the 1st of the month,decrement the month
set /a dd=31, mm-=1
if %mm% GTR 0 goto ^AD
:: If today is 1 Jan, set date to 31st Dec
set /a mm=12, yy-=1
goto DONE
:^AD
for %%a in (4 6 9 11) do if %mm% == %%a goto ^CD
if not %mm%==2 goto DONE
set /a ly=yy%%4
if %ly% EQU 0 (set dd=29) else (set dd=28)
:DONE
if /i %daycount%==0 goto ^DS
if %dd% GTR %daycount% goto ^TM
set /a daycount=%daycount% - %dd%
set dd=1
goto ^CD
:^TM
set /a dd=%dd% - %daycount%
:^DS
:: now convert back to 2-digit dd,mm
if %mm% LSS 10 set mm=0%mm%
if %dd% LSS 10 set dd=0%dd%
goto :EOF