I have set of 5000 CSV files in tree directory structure. Every file was first row denoting its enconding, then typical CSV content follows.
UTF-8
Key1,"Value 1",
Key2,"Value 2"
etc, etc...
How can I quickly collect first row from each file in order to oversee set of their encodings?
I'm trying this with help of this answer but I don't clearly understand all syntax nuances of batch file variables so I am getting stuff like Echo is on.
for /R D:\resources\ %%f in (*.csv) do (
set /p line1=<%%f
echo %line1% >> out.txt
)
If parts are executed individually (for single file), they work.
I was also trying single-liner
for /R D:\resources\ %f in (*.csv) do set /p line1=<%f & echo %line1% >> out.txt
but this one put value collected from first file into output from each file.