I need a batch file to list files stored in a folder but without the ones present in the subfolders?
for %%i in (Y:\Files\*.*) do echo %%~ni >> D:\List_of_files.txt
To have a sorted list (alpahabetically).
for %%i in (Y:\Files\*.*) do echo %%~ni | sort >> D:\List_of_files.txt
This document, titled « Windows - A batch file to list files excluding the subfolders », is available under the Creative Commons
license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM