Batch file for file list

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
 
J

JJ

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
 
S

Seymore4Head

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top