Dot files always first in directory?

Jari Toivanen toivanen at tukki.jyu.fi
Sat May 6 04:28:04 AEST 1989


> From: mchinni at pica.army.mil (Michael J. Chinni, SMCAR-CCS-E)
>
> On our systems (DoD Army) we have a program which uses several files that
> begin with a "," for storage.  These all apear before "." and ".." in the
> directory listings.  Therefore, I would say that you cannot make you
> assumption.  Also, users sometimes create files (by accident) that may begin
> with some of the following characters, all of which would apear before "." and
> "..": ! " # $ % & ' ( ) * + , -

This is already second article that says that files (or directories) which
begins with character that appears before dot ('.') character appears also
directory before "." and ".." entries. This is true if you use ls command
or shell which expands wildcards, because they sort file names before they
shows them.

But if you are using directory(3) c library calls you get files
in the order which they really appears in a directory. When you create a
directory (in BSD or SysV) then the kernel also creates "." and ".." entries
in the new directory. That's why "." and ".." entries are first ones in
a directory. Also you can remove those entries only by removing the directory
where they locate. So they should be first entries in a normal directory.

I not sure is this true for remote file systems. I think that it's not good
to presume so although it might be true almost always (if not even always).
-- 

Jari Toivanen                           Segments are for worms ;-)
Math student at                         Internet: toivanen at tukki.jyu.fi
University of Jyvaskyla, Finland        Bitnet: toivanen_jar at finjyu.bitnet



More information about the Comp.unix.wizards mailing list