I need to create a Windows batch file that generates a .csv file with three fields for all the files in a directory (minus the batch file itself!).
Fields:
Here is a command line one liner that does not include the newly create list file in the list:
(for /f "tokens=1-4*" %A in ('dir /a-d /tc^|findstr "^[0-9]"') do @if "%E" neq "FileList.csv" echo "%E",%A %B %C,%~tE)>"FileList.csv"
Here is a batch script that does not include itself or the newly created list file:
@echo off
>"FileList.csv" (
for /f "tokens=1-4*" %%A in (
'dir /a-d /tc^|findstr "^[0-9]"'
) do if "%~f0" neq "%%~fE" if "%%E" neq "FileList.csv" echo "%%E",%%A %%B %%C,%%~tE
)