File system stats

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I'm trying to find a utility that will give me a summary of file ages in a folder. For example all files modified during 2000, 2001, 2002, etc. Nothing I've found so far will give me a decent report.

Does anyone know of a suitable utility?

Thanks

Robert
 
Hi

I'm trying to find a utility that will give me a summary of file ages in a folder. For example all files modified during 2000, 2001, 2002, etc. Nothing I've found so far will give me a decent report.

Does anyone know of a suitable utility?

Thanks

Robert

Just script it:

@echo off
if {%1}=={} @echo Syntax: FileAge Folder [Dir switches like /tw /s]&goto :EOF
if not exist %1 @echo FileAge - %1 NOT found.&goto :EOF
setlocal
set folder=%1
for /f "Tokens=3 Delims=/" %%a in ('date /t') do (
set year=%%a
)
set low=%year%
set d1=dir %folder% /a /a-d
set f1=findstr /L /C:"/"
:swloop
if {%2}=={} goto swend
set d1=%d1% %2
shift
goto swloop
:swend
for /f "Tokens=3 Delims=/ " %%a in ('%d1%^|%f1%') do (
call :age %%a
)
for /l %%a in (%low%,1,%year%) do (
if defined Y%%a call :report %%a
)
endlocal
goto :EOF
:age
if not defined Y%1 set /a Y%1=0
call set /a Y%1=%%Y%1%% + 1
if "%1" LSS "%low%" set low=%1
goto :EOF
:report
call set /a work=%%Y%1%%
@echo %1 %work%


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Hi

I'm trying to find a utility that will give me a summary of file ages in a folder. For example all files modified during 2000, 2001, 2002, etc. Nothing I've found so far will give me a decent report.

Does anyone know of a suitable utility?

Thanks

Robert

Just script it:

@echo off
if {%1}=={} @echo Syntax: FileAge Folder [Dir switches like /tw /s]&goto :EOF
if not exist %1 @echo FileAge - %1 NOT found.&goto :EOF
setlocal
set folder=%1
for /f "Tokens=3 Delims=/" %%a in ('date /t') do (
set year=%%a
)
set low=%year%
set d1=dir %folder% /a /a-d
set f1=findstr /L /C:"/"
:swloop
if {%2}=={} goto swend
set d1=%d1% %2
shift
goto swloop
:swend
for /f "Tokens=3 Delims=/ " %%a in ('%d1%^|%f1%') do (
call :age %%a
)
for /l %%a in (%low%,1,%year%) do (
if defined Y%%a call :report %%a
)
endlocal
goto :EOF
:age
if not defined Y%1 set /a Y%1=0
call set /a Y%1=%%Y%1%% + 1
if "%1" LSS "%low%" set low=%1
goto :EOF
:report
call set /a work=%%Y%1%%
@echo %1 %work%


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
See tip 8327 in the 'Tips & Tricks' at http://www.jsiinc.com


Thanks, if I can make sense of the script I'll try it out.

Robert

Jerold Schulman said:
Hi

I'm trying to find a utility that will give me a summary of file ages in a folder. For example all files modified during 2000, 2001, 2002, etc. Nothing I've found so far will give me a decent report.

Does anyone know of a suitable utility?

Thanks

Robert

Just script it:

@echo off
if {%1}=={} @echo Syntax: FileAge Folder [Dir switches like /tw /s]&goto :EOF
if not exist %1 @echo FileAge - %1 NOT found.&goto :EOF
setlocal
set folder=%1
for /f "Tokens=3 Delims=/" %%a in ('date /t') do (
set year=%%a
)
set low=%year%
set d1=dir %folder% /a /a-d
set f1=findstr /L /C:"/"
:swloop
if {%2}=={} goto swend
set d1=%d1% %2
shift
goto swloop
:swend
for /f "Tokens=3 Delims=/ " %%a in ('%d1%^|%f1%') do (
call :age %%a
)
for /l %%a in (%low%,1,%year%) do (
if defined Y%%a call :report %%a
)
endlocal
goto :EOF
:age
if not defined Y%1 set /a Y%1=0
call set /a Y%1=%%Y%1%% + 1
if "%1" LSS "%low%" set low=%1
goto :EOF
:report
call set /a work=%%Y%1%%
@echo %1 %work%


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Back
Top