Display the contents of a folder

  powerless 21:28 21 Apr 2004

How do you display the contents of a folder through a command prompt?

...and have the results sent to a text file?

Windows XP.

This has been posted on here before but cannot find it.

  paddyjack 21:53 21 Apr 2004

try here click here

  QuickHare 22:03 21 Apr 2004

The simplest way is to use the command DIR. To use it to display filenames, use

DIR *.* /B

and to send this to a file, use a redirection. So the full command to use is

DIR *.* /B >path\file.ext

  paddyjack 22:20 21 Apr 2004

glasses need cleaning


is right but .ext should be .txt, no doubt you realised that

  DAG88 22:40 21 Apr 2004

does .ext stand for any file extension?

  powerless 22:43 21 Apr 2004

Thats works :)


How would I get it to display the same file extensions together? As at the moment there all scrmabled together.

vbs. red, zip

  paddyjack 22:50 21 Apr 2004

I think you will find one file one type so it would be DIR *.vbs /B >path\file.txt etc, but the other option might be arrange your folder by type

  paddyjack 22:55 21 Apr 2004


the command as DIR *.* /B >path\file.ext, should be DIR *.* /B >path\file.txt to make a text file, the file extension is DIR *.* (list all files, and all extensions)it could equally be DIR *.mp3 (that would be all mp3 files).

  QuickHare 20:41 23 Apr 2004

My notation (and commands) expanded a bit:

DIR = Short for Directory listing
*.* = Finds all files
/B = BARE FORMAT switch to make a list only
> = Redirects output to the following place
path\ = Path, may include drive.
file = Any FILEname
.ext = Any EXTension.

Sorry if this confused.

  QuickHare 20:44 23 Apr 2004

DIR *.* /B /OE >path\file.txt

The /OE orders by Extension. N is by name, S is by size, D is by date, G groups directories (folders) first and putting - in reverses the order. You can use any you want in any order.

  Boluwd 21:12 23 Apr 2004

to my postings

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

AMD Radeon Adrenalin release date, new features, compatible graphics cards

Inside the iMac Pro - Apple's most powerful Mac yet

iMac Pro release date, UK price & specs

Football : comment regarder la Ligue 1 en direct ?