I have scripted ReportOld.bat to generate a CSV (Comma Separated Value) file of old files. The CSV file contains the Owner, date, and file name.

The syntax for using ReportOld.bat is:

ReportOld StartPath CSVfile \[Days\]


StartPath is the path to the drive or folder that contains the files.

CSVfile is the output file path.

Days is an optional file age parameter. The default is 60 days.

ReportOld.bat makes use of FORFILES, SubInACL, and Owner.bat.

ReportOld.bat contains:

@echo off
if "%$ReportOld%" EQU "Y" goto :parse
set batch=%~f0
set batch=0x22%batch:"=%0x22
if \{%1\}<h1><a name="_goto_syntax_if_2_">\{\} goto syntax
if \{%2\}</a></h1>\{\} goto syntax
if not exist %1 goto syntax
set rpt=%~dp2
if not exist %rpt% goto syntax
set rpt=%2
if exist %rpt% del /q %rpt%
if exist "%TEMP%\ReportOld.tmp" del /q "%TEMP%\ReportOld.tmp"
if \{%3\}<h1><a name="_set_days_60_amp_goto_begin_set_days_3_if_days_0_1_EQU_0_goto_syntax_begin_set_ReportOld_Y_setlocal_set_folder_1_forfiles_p_folder_d_days_s_c_cmd_c_if_not_ISDIR">\{\} set days=60&goto begin
set days=%3
if "%days:~0,1%" EQU "0" goto syntax
set $ReportOld=Y
set folder=%1
forfiles -p%folder% -d-%days% -s -c"cmd /c if not @ISDIR</a></h1>TRUE call %batch% 0x22@PATH\@FILE0x22 0x22@FDATE0x22"
set $ReportOld=
if not exist "%TEMP%\ReportOld.tmp" goto finish
sort "%TEMP%\ReportOld.tmp" /O %rpt%
del /q "%TEMP%\ReportOld.tmp"
set $ReportOld=
goto :EOF
@echo Syntax: ReportOld StartPath ReportFile \[Days\]
set rpt=
set $ReportOld=
goto :EOF
set file=%1
set dte=%2
call Owner %file%
if /i "%$Owner:~0,8%" EQU "builtin\" goto :EOF
@echo "%$Owner%",%dte%,%file% >>"%TEMP%\ReportOld.tmp"