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\}

\{\} goto syntax if \{%2\}

\{\} 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\}

\{\} set days=60&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

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" :finish endlocal set $ReportOld= goto :EOF :Syntax @echo Syntax: ReportOld StartPath ReportFile \[Days\] @echo. endlocal set rpt= set $ReportOld= goto :EOF :parse 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"