Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DIR without header/summary but with file size + creation date/time ?

9,252 views
Skip to first unread message

Tom Miller

unread,
Jul 28, 2002, 8:40:10 AM7/28/02
to
Sorry for this simple question: But how do I get a file list without
header and summary lines but with full file information (=file size and file creation date/time) ?

If I say

dir /B

I get no header/summary but also no file size/date

If I say

dir

I get file size/date information but with header/summary lines

Isn't there a mixture ? I need it for a msdos batch file.

Thx
Tom

William Allen

unread,
Jul 28, 2002, 9:10:49 AM7/28/02
to
"Tom Miller" wrote in message
...snip

> But how do I get a file list without
> header and summary lines but with full file information (=file size and file creation date/time) ?

Use a FIND or a FINDSTR filter. For help with FIND, type
find /?
For help with FINDSTR (enhanced version of FIND), type
findstr /?

For example, suppose your date separator is the / character:

DIR *.* | find "/">FILENAME.EXT
will redirect a listing filtering IN only lines containing / character.

You can use multiple FINDs in a multi-stage pipe. For example
if your time separator is : [colon] then you can filter IN that,
and filter out DIRECTORY to avoid the "directory" line(s):

DIR *.* | find ":" | find /v /i "DIRECTORY"

or, as above, you can redirect the result to a file instead of
the display screen:

DIR *.* | find ":" | find /v /i "DIRECTORY">FILENAME.EXT

See Note 1 for a simple guide to Batch operations.

--
(pp) William Allen

Note 1
======Quick summary of Windows 95/98/ME Batch/MS-DOS information

===Internal Commands:

Common internal commands (coded in COMMAND.COM) include: ECHO, IF, SET,
CALL, DIR, DATE, TIME, COPY, TYPE, PAUSE, PROMPT, PATH, SHIFT, GOTO,
CLS, FOR, LFNFOR, CD, MD, RD, REN, DEL, ERRORLEVEL, REM and the
@ prefix(=ECHO off for one line).

===External Commands:

Command external commands (stand-alone utilities) include: attrib,
choice, debug, deltree, fc, find, more, move, sort, start, xcopy.

===Online help with /? switch

Get help with any of these supported on your system by typing (at the
DOS prompt) the CommandName with the /? help switch, for example:
dir /?
prompt /?
xcopy /?
(but note that ERRORLEVEL is explained under the corresponding IF test).

===Batch operators

There are also three important operators. They are: > >> and |
1) The > or NewFile redirection operator: ECHO. Message>NEWFILE.TXT
writes " Message" to NEWFILE.TXT (deleting any existing same-name file).
2) The >> or AppendToFile operator: ECHO. Additions>>OLDFILE.TXT
adds " Additions" to existing OLDFILE.TXT (but >> creates a new file if
there is no pre-existing file).
3) The | or Pipe operator sends the output of one command to another:
TYPE FileName.EXT | find "keyword"
types FileName.EXT through FIND, displaying lines that contain "keyword".
(The pipe operator is the ASCII 124 character)

===Batch parameters

To access parameters passed in a Batch file command line, as in:
mybatch.bat Parameter1 Parameter2 Parameter3
use the symbols %1, %2, %3 and so on to %9. The %0 symbol holds the
name with which the Batch file was invoked (and would hold mybatch.bat
in the example above). Use SHIFT to access any parameters beyond the
initial %9 value. SHIFT shifts remaining parameters into the scope of
the %0 - %9 symbols (losing previous values in the process).

===Environment variables

To expand environment variables, use %VarName%, thus:
SET MYVAR=SomeString
ECHO. Variable MYVAR=%MYVAR%

===ECHOing % literally

To ECHO a % symbol as a literal, double it:
ECHO. Display [PercentSymbol]1 literally: %%1
ECHO. Display [PercentSymbol]MYVAR[PercentSymbol] literally: %%MYVAR%%

===File/Folder names with [Space]s

File or folder names that include [Space]s need to have "quotes" around
the entire specification when they're used in command lines, thus:
COPY /y "C:\Folder 1\Source file.txt" "C:\Folder 2\Destination file.txt"
(for names that don't include [Space]s, you can either use "quotes" if
you wish, or leave them out)

===Wildcards

Many commands accept wildcard-specified filenames (using * and ?). Use
* to mean any number of characters (including none) and use ? to mean
exactly one character in that position, eg:

DEL *.BAK (delete files with any basename and extension BAK)
DIR WIN*.EXE (files matching basename WIN[anything] and extension EXE)
DIR WIN???.EXE (files matching WIN[ExactlyThreeCharacters].EXE

Note on wildcard deletion:
DEL *?.*
Matches all files (except Hidden, System, or Read-only files) in
current folder without confirmation prompt, so use with care!

===Legacy MS-DOS 6.22 help system

Windows 95/98/ME users can install the legacy MS-DOS 6.22 help system.
On your Windows CD-ROM, locate the three files:
HELP.COM HELP.HLP QBASIC.EXE
(these are typically in OTHER/OLDMSDOS or similar). Copy these files
to the folder C:\WINDOWS\COMMAND to install the help system.

With legacy MS-DOS help installed, use the Help command, for example:
help batch
(to find details of simple batch commands). The help system has extensive
documentation for the legacy version MS-DOS 6.22. Much of this information
(but NOT all) still applies to Windows 95/98/ME. At DOS prompt, simply
type: "help" to start the main help index.


Mike Walsh

unread,
Jul 28, 2002, 12:53:47 PM7/28/02
to
Try something like this:

Dir C:\directoryname /s /a:-d |find "/"

/s will list subdirectories
/a:-d will suppress directory entries

--
Mike Walsh
West Palm Beach, Florida, U.S.A.

Dr John Stockton

unread,
Jul 29, 2002, 5:54:36 AM7/29/02
to
JRS: In article <3D44219B...@telocity.com>, seen in
news:alt.msdos.batch, Mike Walsh <mike...@telocity.com> posted at Sun,
28 Jul 2002 12:53:47 :-

>Try something like this:
>
>Dir C:\directoryname /s /a:-d |find "/"
>
>/s will list subdirectories
>/a:-d will suppress directory entries

The OP is posting from TZ +0200, and using T-Online. One should,
therefore, allow for the probability that he is using what the DOS
manual asserts to be the German notation for date/time, 03.01.1991
17:35:00,00 - and for that 'find "/"' will not work. But 'find "."'
might well do; one would need to see the output of a German DIR to be
sure.

HUNT, via sig line 3. will do what the OP asks for (using the e
parameter) without nationalistic discrimination.

--
© John Stockton, Surrey, UK. j...@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP <URL:http://www.merlyn.demon.co.uk/programs/> - 00index.txt.
Do not Mail News to me. Before a reply, quote with ">" or "> " (SoRFC1036)

R.Wieser

unread,
Jul 31, 2002, 4:55:10 AM7/31/02
to
Tom Miller <ttt...@yahoo.com> schreef in berichtnieuws
ai0on9$ohs$01$1...@news.t-online.com...

Hello Tom,

> Sorry for this simple question:

Don't be. Remember those little, yellow, sticking *everywhere*, notes ?
That started with just a simple question, and see what has become of it :-)

> But how do I get a file list without
> header and summary lines but with full file information (=file size and
file creation date/time) ?

[Snip]

> Isn't there a mixture ? I need it for a msdos batch file.

You can try this :

dir | find "-" | find ":"

It will do a normal DIR, and the FIND -instructions will remove all lines
that do *not* have both ":" and "-" in them. And guess what, only standard
directory-entries seen to have them :-)

Regards,
Rudy Wieser

Sam Ple

unread,
Jul 31, 2002, 12:45:44 PM7/31/02
to
It's cheesy but how about:

dir | find "-"

?
Finds the occurences of "-" in dates which do not (on my system) occur in
the header/summary. Warning - results can vary based on Dos version and
locale.


"Tom Miller" <ttt...@yahoo.com> wrote in message
news:ai0on9$ohs$01$1...@news.t-online.com...

Charles Dye

unread,
Aug 1, 2002, 1:13:32 PM8/1/02
to

As usual, 4DOS users have a trivial solution:

c:\bin\elvis>ver

4DOS 7.01A (Win98) DOS 7.10

c:\bin\elvis>dir

Volume in drive C is BOOT Serial number is 1A29:1DF6
Directory of C:\BIN\ELVIS\*

6-09-2001 18:39 <DIR> .
6-09-2001 18:39 <DIR> ..
6-09-2001 18:39 <DIR> LIB
9-02-2000 19:00 359 COPYING
9-02-2000 19:00 23,291 CTAGS.EXE
9-04-2000 10:39 166,787 ELVIS.EXE
9-16-2001 10:00 754 ELVIS.RC
9-02-2000 19:00 12,303 FMT.EXE
9-02-2000 19:00 42,000 README.HTM
9-02-2000 19:00 28,083 REF.EXE
12-20-2001 10:00 628 TEST.BTM
274,205 bytes in 8 files and 3 dirs 458,752 bytes allocated
1,865,252,864 bytes free

c:\bin\elvis>dir /mk
6-09-2001 18:39 <DIR> .
6-09-2001 18:39 <DIR> ..
6-09-2001 18:39 <DIR> LIB
9-02-2000 19:00 359 COPYING
9-02-2000 19:00 23,291 CTAGS.EXE
9-04-2000 10:39 166,787 ELVIS.EXE
9-16-2001 10:00 754 ELVIS.RC
9-02-2000 19:00 12,303 FMT.EXE
9-02-2000 19:00 42,000 README.HTM
9-02-2000 19:00 28,083 REF.EXE
12-20-2001 10:00 628 TEST.BTM

c:\bin\elvis>

Of course these options are not present in COMMAND.COM or CMD.EXE.

--
Charles Dye ras...@highfiber.com


Phil Robyn

unread,
Aug 1, 2002, 2:49:07 PM8/1/02
to

Win2000 CMD.EXE:

To show file detail only:

C:\cmd>dir ztxt\p* | findstr "\/ "
09/17/1999 10:24a 959 PLAINFTPCMD.txt
03/10/2000 11:49a 2,252 PROGRESS.TXT
11/10/1999 04:28p 8,192 PSJSCHED.PKG
08/01/2000 03:12p 2,930 PTOUPLD.PKG
09/13/2000 02:55p 3,353 pxrupld1.txt


To show file detail and summary without header lines:

C:\cmd>dir ztxt\p* | findstr "\/ ("
09/17/1999 10:24a 959 PLAINFTPCMD.txt
03/10/2000 11:49a 2,252 PROGRESS.TXT
11/10/1999 04:28p 8,192 PSJSCHED.PKG
08/01/2000 03:12p 2,930 PTOUPLD.PKG
09/13/2000 02:55p 3,353 pxrupld1.txt
5 File(s) 17,686 bytes
0 Dir(s) 5,731,164,160 bytes free

--
t o s e n d e - m a i l u s e ' R e p l y - T o '
o r u n z i p m y ' F r o m ' a d d r e s s ....

0 new messages