KOMPX.COM or COMPMISCELLANEA.COM   

Recursively listing file names only (without path) in Windows Command Prompt

Listing only file names (not folder names), without path, from a directory and all its subdirectories in Windows Command Prompt. The list is then printed into a file:


( FOR /R %G IN (*) DO @ECHO %~NXG ) > FILES.TXT

Code for .BAT file:


@ECHO OFF
FOR /R %%G IN (*) DO (
	ECHO %%~NXG
) >> FILES.TXT

Operating systems
More