Question : DIR command to list directory contents to text file

I need the DIR syntax to dump a list of directories, subdirectories, and files to a text file.  I need the following data in the resulting text file:
Full path to the file or folder
Full filename with extension
ALL FILES (system, hidden, read only)
Time created
Time written (modified)

Answer : DIR command to list directory contents to text file

To do a little debugging I have added a couple of ECHO's to the script, try this and let me know what it displays.

@echo off
setlocal EnableDelayedExpansion
set BaseDir=U:\DRPMAAA\GDAS\Public Files\Training IPT\Lima_OakGrove_Training Materials
set OutputFile=C:\listwritten6.csv
if exist "%OutputFile%" del "%OutputFile%"
for /f "delims=" %%A in ('dir /b /a-d /s "%BaseDir%"') do (
  echo FOR1: "%%A"
  for /f "tokens=1-3" %%B in ('dir /tc "%%~fA"^|findstr /b "[0-9][0-9]/"') do (
    echo FOR2: "%%B"
    dir /tc "%%~fA"
    echo "%%~fA","%%~tA","%%B %%C %%D">>"%OutputFile%"
  )
)

~bp
Random Solutions  
 
programming4us programming4us