How do I list all files recursively,sorted,without PATH on command line ?

C

Claudia Miller

I want to list all files in a whole directory tree.
They should be sorted by their filenames EXCLUDING (!) the path.

If I type e.g.

dir /A /S /B

all files are listed but they are sorted including the prepended path part.

How can I omit/suppress the path and list only the files (and sort them) ?

I consider a DOS command (under Win2000/WinXP) or alternatively
an external utility is acceptable as well as long as it works at the command prompt.

Claudia
 
P

Pegasus \(MVP\)

Claudia Miller said:
I want to list all files in a whole directory tree.
They should be sorted by their filenames EXCLUDING (!) the path.

If I type e.g.

dir /A /S /B

all files are listed but they are sorted including the prepended path part.

How can I omit/suppress the path and list only the files (and sort them) ?

I consider a DOS command (under Win2000/WinXP) or alternatively
an external utility is acceptable as well as long as it works at the command prompt.

Claudia

This is a little difficult to achieve: DOS is an operating
system, same as Windows or Linux, and there is definitely
no DOS under Windows. There is also not a single
command in Windows that will do exactly what you want.
However, you could use this batch file:

@echo off
if exist "%temp%\dir.tmp" del "%temp%\dir.tmp"
for /r %%a in (.) do (
echo Processing %%a
dir "%%a" /a-d /b | find /i /v "file not found" >> "%temp%\dir.tmp"
)
type "%temp%\dir.tmp" | sort > "%temp%\dir.txt"
type "%temp%\dir.txt" | more
 
P

POP

DIR /s/o

Gives:
Directory of C:\CABS\Winxp\Dx9

05/21/2006 11:35 AM <DIR> .
05/21/2006 11:35 AM <DIR> ..
05/21/2006 11:35 AM 11,871,576 DX9NT.exe
05/21/2006 11:35 AM 450 INSTALLF.INI
05/21/2006 11:35 AM 450 INSTALLS.INI
05/21/2006 11:35 AM 450 INSTALLU.INI
05/21/2006 11:35 AM 553,984 PINSTALL.EXE
05/21/2006 11:35 AM 387 scriptit.scp
05/21/2006 11:35 AM 224 SRCD.es
05/21/2006 11:35 AM 224 SRCD.fr
05/21/2006 11:35 AM 236 SRCD.ini
9 File(s) 12,427,981 bytes

DIR /? for a list of all the tags.

HTH
Pop


In
 
P

POP

You're an idiot for pretending not to know what the OP means.
Several DOS commands work in windows, plus a lot that MSDOS never
had. The names DOS vs Command Prompt are for people like you who
wish to creat confusion with newbies who don't know better. YOU
are the one who doesn't know any better though.

No discussion; it's a fact.


In
 

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