Batch file for file list

  • Thread starter Thread starter Seymore4Head
  • Start date Start date
S

Seymore4Head

dir d:\01 /s/b/o > fileslist.txt

I want a list of files from current folder and subdirectories, but I
don't want the directories displayed.

How do you list files in subfolders but not the path?

Thanks

ie all I want is a lists
file1.txt
file2.txt
file3.txt
 
dir d:\01 /s/b/o > fileslist.txt

I want a list of files from current folder and subdirectories, but I
don't want the directories displayed.

How do you list files in subfolders but not the path?

Thanks

ie all I want is a lists
file1.txt
file2.txt
file3.txt

Use FOR command. e.g.:

In a single line...(long text warning)

rem.>fileslist.txt&for /r "d:\01" %F in (*) do @echo %~nxF >>fileslist.txt

In a batch file...

@echo off
rem.>fileslist.txt
for /r "d:\01" %%F in (*) do echo %%~nxF >>fileslist.txt
 
Use FOR command. e.g.:

In a single line...(long text warning)

rem.>fileslist.txt&for /r "d:\01" %F in (*) do @echo %~nxF >>fileslist.txt

In a batch file...

@echo off
rem.>fileslist.txt
for /r "d:\01" %%F in (*) do echo %%~nxF >>fileslist.txt

Thanks
 
Back
Top