@echo off
setlocal enabledelayedexpansion
set root=P:\Contractor Work
set report=report.csv
echo Total PDF Files,Total XLS Files,New Files,Total Files > "%report%"
for /f "tokens=*" %%G in ('dir "%root%" /a:d /b') do (
set pdfcount=0
set xlscount=0
set totalcount=0
set newcount=0
for /f %%H in ('dir "%root%\%%G\*.pdf" /a:-d /b /s') do set /a pdfcount+=1
for /f %%H in ('dir "%root%\%%G\*.xls" /a:-d /b /s') do set /a xlscount+=1
for /f "tokens=*" %%H in ('dir "%root%\%%G" /a:d /b /o:d /t:c') do set newest=%%H
for /f %%H in ('dir "%root%\%%G\!newest!" /a:-d /b /s') do set /a newcount+=1
for /f %%H in ('dir "%root%\%%G" /a:-d /b /s') do set /a totalcount+=1
echo "%%G",!pdfcount!,!xlscount!,!newcount!,!totalcount! >> "%report%"
)
|