[comp.sys.ibm.pc] dir | more

cheangkk@pnet51.orb.mn.org (Pitt Cheang) (03/14/90)

When I tyied to dir the root directory of my hard disk , floppy disk with the
more , I always got two strange file name with 0 byte, the file name contains
mostly number with 8 characters long, no extention name.
 
When I check this command " dir | more " or " dir/w | more " on my firends
computer, it appear the same thing. I am using PC-DOS 3.3 , my friend is using
MS-DOS 3.3. Moreover, those strange file name are always change, every time
you try you got a different name.

So what is this file name do ?

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 ( Pitt Cheang )  Input, Input, Input, I want more input !!!

 UUCP: {amdahl!bungia, uunet!rosevax, crash}!orbit!pnet51!cheangkk
 ARPA: crash!orbit!pnet51!cheangkk@nosc.mil
 INET: cheangkk@pnet51.orb.mn.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

steve@wintermute.ucsd.edu ({Darkavich}) (03/16/90)

In article <2165@orbit.cts.com> cheangkk@pnet51.orb.mn.org (Pitt Cheang) writes:
>When I tyied to dir the root directory of my hard disk , floppy disk with the
>more , I always got two strange file name with 0 byte, the file name contains
>mostly number with 8 characters long, no extention name.
> 
>When I check this command " dir | more " or " dir/w | more " on my firends
>computer, it appear the same thing. I am using PC-DOS 3.3 , my friend is using
>MS-DOS 3.3. Moreover, those strange file name are always change, every time
>you try you got a different name.
>
>So what is this file name do ?

This behaviour can be seen anytime you use the pipe '|' 
I do not really know why dos creates these files but it may have something
to do with file pointers or memory pointers.  


		Steve Misrack
		steve@ucsd.edu

kaleb@mars.jpl.nasa.gov (Kaleb Keithley) (03/16/90)

In article <2165@orbit.cts.com> cheangkk@pnet51.orb.mn.org (Pitt Cheang) writes:
>When I tyied to dir the root directory of my hard disk , floppy disk with the
>more , I always got two strange file name with 0 byte, the file name contains
>mostly number with 8 characters long, no extention name.
> 
>When I check this command " dir | more " or " dir/w | more " on my firends
>computer, it appear the same thing. I am using PC-DOS 3.3 , my friend is using
>MS-DOS 3.3. Moreover, those strange file name are always change, every time
>you try you got a different name.
>
>So what is this file name do ?
>

Pipes in MS-DOS are really just temporary files, with some software wrappers
to make them work like *nix (or is it *ix.)  There is a DOS function that
creates a unique file name (probably mostly numbers) which the "wrapper"
uses.  After the second program in the pipe is done, COMMAND no doubt truncates
the file to zero length, and then deletes it. 

The reason you see these files in "DIR | MORE" is because COMMAND creates the
temporary file before the DIR, and the file is visible for the duration
of the pipe.  What you really want to do is "DIR /P" which pauses just like 
MORE does when you pipe a file through it.

kaleb@mars.jpl.nasa.gov            Jet Propeller Labs
Kaleb Keithley

spelling and grammar flames > /dev/null

jfrench@photon.tamu.edu (Jeff French) (03/16/90)

In article <12503@ucsd.Edu> steve@wintermute.ucsd.edu ({Darkavich}) writes:
>In article <2165@orbit.cts.com> cheangkk@pnet51.orb.mn.org ( Cheang) writes:

>When I tyied to dir the root directory of my hard disk , floppy disk with the
>more , I always got two strange file name with 0 byte, the file name contains
>mostly number with 8 characters long, no extention name.
> 
>When I check this command " dir | more " or " dir/w | more " on my firends
>computer, it appear the same thing. I am using PC-DOS 3.3 , my friend is using
>MS-DOS 3.3. Moreover, those strange file name are always change, every time
>you try you got a different name.

  The files are DOS temporary files created using the "|" pipe filter.
  The odd file names are provided by the system clock and are in hex. Thus
  DOS can have multilple temp files and assure that they are all named
  differently. 

  Also note that this phenomenon only occurs in the root directory and with
  DOS ver 3.x or greater. Earlier versions had PIPE in the temp name.

  At any rate, use "dir/p" instead of "dir | more". It's faster and provides
  the same end result.
---------------------------------------------------------------------
    jfrench@cssuN.tamu.edu       Jeff French        "Gig-Em Aggies"
---------------------------------------------------------------------

cs4g6ag@maccs.dcss.mcmaster.ca (Stephen M. Dunn) (03/17/90)

In article <2165@orbit.cts.com> cheangkk@pnet51.orb.mn.org (Pitt Cheang) writes:
$When I tyied to dir the root directory of my hard disk , floppy disk with the
$more , I always got two strange file name with 0 byte, the file name contains
$mostly number with 8 characters long, no extention name.

   Those are the pipe files.  Since DOS is a single-tasking operating system,
it cannot implement pipes properly (i.e. two processes running concurrently,
using an area of memory to store the information in the pipe).  What it does
is it creates temporary files on the disk which substitute for the pipe.  The
first program runs with its output redirected into a file, and then when
it terminates, DOS runs the second program with its input redirected from
that file.  Once the second process has terminated, DOS removes the files.
What you're seeing when you do a directory is a listing including these
files after they have been opened (of course, they must be opened before
the first process is executed) but before anything has been put into them.
-- 
Stephen M. Dunn                               cs4g6ag@maccs.dcss.mcmaster.ca
          <std_disclaimer.h> = "\nI'm only an undergraduate!!!\n";
****************************************************************************
    "So sorry, I never meant to break your heart ... but you broke mine."

tfabian@mars.lerc.nasa.gov (Ted Fabian) (03/20/90)

In article <2165@orbit.cts.com> cheangkk@pnet51.orb.mn.org (Pitt Cheang) writes:
>When I tyied to dir the root directory of my hard disk , floppy disk with the
>more , I always got two strange file name with 0 byte, the file name contains
>mostly number with 8 characters long, no extention name.
> 
>When I check this command " dir | more " or " dir/w | more " on my firends
>computer, it appear the same thing. I am using PC-DOS 3.3 , my friend is using
>MS-DOS 3.3. Moreover, those strange file name are always change, every time
>you try you got a different name.
>
>So what is this file name do ?
>
>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> ( Pitt Cheang )  Input, Input, Input, I want more input !!!
>
> UUCP: {amdahl!bungia, uunet!rosevax, crash}!orbit!pnet51!cheangkk
> ARPA: crash!orbit!pnet51!cheangkk@nosc.mil
> INET: cheangkk@pnet51.orb.mn.org
>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



when you run the DIR command through the MORE pipe utility, that
utility creates a temporary file which it then displays.. but at the time 
of the listing of the directory, that temporary file is empty, so it only
shows up as zero bytes... it's deleted when the MORE pipe finishes.. 
names vary depending on the time it runs...



-- 
----------------------------------------------------
Thanks,    Ted Fabian   NASA Lewis Research Center
           tpfabian@nasamail.nasa.gov      *my opinions 
           tfabian@mars.lerc.nasa.gov      *are my own..
-- 
----------------------------------------------------
Thanks,    Ted Fabian   NASA Lewis Research Center
           tpfabian@nasamail.nasa.gov      *my opinions 
           tfabian@mars.lerc.nasa.gov      *are my own..

cheangkk@pnet51.orb.mn.org (Pitt Cheang) (03/23/90)

Thanks for all the people who help me out with the question. However, one more
question, why this only happending in the root directory instead of all
subdirectory ?
 
Thanks Again.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 ( Pitt Cheang )  Input, Input, Input, I want more input !!!

 UUCP: {amdahl!bungia, uunet!rosevax, crash}!orbit!pnet51!cheangkk
 ARPA: crash!orbit!pnet51!cheangkk@nosc.mil
 INET: cheangkk@pnet51.orb.mn.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

keith@sdscal.UUCP (Keith Jones) (03/24/90)

In article <12503@ucsd.Edu>, steve@wintermute.ucsd.edu ({Darkavich}) writes:
> In article <2165@orbit.cts.com> cheangkk@pnet51.orb.mn.org (Pitt Cheang) writes:
> >When I tyied to dir the root directory of my hard disk , floppy disk with the
> >more , I always got two strange file name with 0 byte, the file name contains
> >mostly number with 8 characters long, no extention name.
>
> This behaviour can be seen anytime you use the pipe '|' 
> I do not really know why dos creates these files...

I'm sure I'm not going to be the only one to answer this but ...

These files are created by COMMAND.COM because MS-DOS has no real method for
providing pipes between processes ... you can only have one process at a
time so you take the output of the first process, save it in a temp file,
and then feed this temp file into the second process.  There looks to be a
little more than this to it, but the end effect is the same.

For example:

C:\TEMP> DIR | MORE

is the same as

C:\TEMP> DIR > 0E0C1D45
C:\TEMP> MORE < 0E0C1D45
C:\TEMP> DEL 0E0C1D45

Some command processors for the Amiga did this to implement pipes, even
though the Amiga OS ostensibly allows multiple processes.

I hope this sheds some light on the problem.

Keith.
-- 
Keith Jones			...!calgary!spycal!sdscal!keith
Stream Data Systems		I don't have a signature because my pen
Calgary, Alberta, Canada	keeps scratching up my monitor.

georgf@polari.UUCP (George Forsman) (03/27/90)

In article <2219@orbit.cts.com> cheangkk@pnet51.orb.mn.org (Pitt Cheang) writes:
>Thanks for all the people who help me out with the question. However, one more
>question, why this only happending in the root directory instead of all
>subdirectory ?
> 
>Thanks Again.
>
>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> ( Pitt Cheang )  Input, Input, Input, I want more input !!!
>
 The file only appear in the root because MS-DOS (specifically command.com)
uses the root directory for it's temporary files.  It would be nice if it
would use a TMP= environment variable for those files, but it does not.
  So what this comes down to is: no matter what subdirectory you are in, DOS
will use the ROOT directory of the current drive for the PIPE temporary files.
(This can be a problem when doing a DIR | SORT on a write-protected diskette).

 -George
...uw-beaver!sumax!polari!georgf
Lack of .sig from procrastinators inc.

toma@tekgvs.LABS.TEK.COM (Tom Almy) (03/28/90)

In article <1461@polari.UUCP> georgf@.UUCP (George Forsman) writes:
[pipe temporary files appear in the rood directory of the current drive]
> The file only appear in the root because MS-DOS (specifically command.com)
>uses the root directory for it's temporary files.  It would be nice if it
>would use a TMP= environment variable for those files, but it does not.

This problem doesn't exist with 4DOS, which uses the environment variable.
4DOS seems to fix just about everybody's complaints about command.com
(except for those people who are unsatisfied with anything but UNIX)
and at $35 ($50 with manual and "next upgrade") is a steal!
Tom Almy
toma@tekgvs.labs.tek.com
Standard Disclaimers Apply