2020. augusztus 11., kedd

Reccursive directory list to CSV in a single

 How to create a recursive list of all files and separate size, path, filename and extension into CSV fields in a single command line of standard Windows 10 CMD?

TL;DR for the current directory, not including directories:

for /f "delims=*" %A in ('dir /s /b /a:-d') ^
do @echo %~zA,"%~pA","%~nA",%~xA >>dirlist.csv

(feel free to omit the carrot and put it on a single line)

  • Details: you can use the Parameter Expansion known from parsing the command line arguments on parameters of the FOR command (yes, even if you indicate %L you can have %M, %N and so on as well) https://ss64.com/nt/syntax-args.html and
  • https://ss64.com/nt/for.html

Have fun!

Rendszeres olvasók