1. "." and ".." returned by dir()

Hello Rob and all,

in the documentation of dir() it reads:
<quote>
If st names a *directory* you may have entries for "." and ".."
</quote>

After my experience, those entries are normally at the _beginning_
of the list which is returned by dir(). Can I rely on the assumption
that this is _always_ the case?

Regards,
   Juergen

new topic     » topic index » view message » categorize

2. Re: "." and ".." returned by dir()

Juergen Luethje wrote:
> 
> Hello Rob and all,
> 
> in the documentation of dir() it reads:
> <quote>
> If st names a *directory* you may have entries for "." and ".."
> </quote>
> 
> After my experience, those entries are normally at the _beginning_
> of the list which is returned by dir(). Can I rely on the assumption
> that this is _always_ the case?
> 
> Regards,
>    Juergen

Hi Juergen.
I don't know for shure, but methinks that DOS returns the files and the
directories ordered by date.
If this is always true, it might be that you have some files dated earlier
than the directories where they reside, so this may not be always true.
This can happen if you create a directory and then you move some files to it.
Regards.

new topic     » goto parent     » topic index » view message » categorize

3. Re: "." and ".." returned by dir()

Juergen Luethje wrote:
> in the documentation of dir() it reads:
> <quote>
> If st names a *directory* you may have entries for "." and ".."
> </quote>
> 
> After my experience, those entries are normally at the _beginning_
> of the list which is returned by dir(). Can I rely on the assumption
> that this is _always_ the case?

I don't know.
I don't force it to be that way.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

4. Re: "." and ".." returned by dir()

Robert Craig wrote:

> Juergen Luethje wrote:
>> in the documentation of dir() it reads:
>> <quote>
>> If st names a *directory* you may have entries for "." and ".."
>> </quote>
>> 
>> After my experience, those entries are normally at the _beginning_
>> of the list which is returned by dir(). Can I rely on the assumption
>> that this is _always_ the case?
> 
> I don't know.
> I don't force it to be that way.

Thank you, both Ricardo and Rob!
So in order to play it safe, I'll not rely on that assumption.

Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

5. Re: "." and ".." returned by dir()

Juergen Luethje wrote:
> 
> Hello Rob and all,
> 
> in the documentation of dir() it reads:
> <quote>
> If st names a *directory* you may have entries for "." and ".."
> </quote>
> 
> After my experience, those entries are normally at the _beginning_
> of the list which is returned by dir(). Can I rely on the assumption
> that this is _always_ the case?
> 
> Regards,
>    Juergen

I suppose you can since the single dot refers to the directory itself and the
two dots refer to its parent directory (i.e., the directory that contains it).

JG

new topic     » goto parent     » topic index » view message » categorize

6. Re: "." and ".." returned by dir()

Ricardo M. Forno wrote:
> 
> Juergen Luethje wrote:
> > 
> > Hello Rob and all,
> > 
> > in the documentation of dir() it reads:
> > <quote>
> > If st names a *directory* you may have entries for "." and ".."
> > </quote>
> > 
> > After my experience, those entries are normally at the _beginning_
> > of the list which is returned by dir(). Can I rely on the assumption
> > that this is _always_ the case?
> > 
> > Regards,
> >    Juergen
> 
> Hi Juergen.
> I don't know for shure, but methinks that DOS returns the files and the
> directories ordered by date.
> If this is always true, it might be that you have some files dated earlier
> than the directories where they reside, so this may not be always true.
> This can happen if you create a directory and then you move some files to it.
> Regards.


No, the dots will appear first even if files contained in it are dated earlier
than the directory.

JG

new topic     » goto parent     » topic index » view message » categorize

7. Re: "." and ".." returned by dir()

Julio C. Galaret Viera wrote:

> Juergen Luethje wrote:
> > 
> > Hello Rob and all,
> > 
> > in the documentation of dir() it reads:
> > <quote>
> > If st names a *directory* you may have entries for "." and ".."
> > </quote>
> > 
> > After my experience, those entries are normally at the _beginning_
> > of the list which is returned by dir(). Can I rely on the assumption
> > that this is _always_ the case?
> > 
> > Regards,
> >    Juergen
> 
> I suppose you can since the single dot refers to the directory itself and the
> two dots refer to its parent directory (i.e., the directory that contains it).

Yes, that is the meaning of those entries. But does their meaning tell us
anything about the order, in which they are returned by dir()?

Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

8. Re: "." and ".." returned by dir()

Juergen Luethje wrote:
> 
> Julio C. Galaret Viera wrote:
> 
> > Juergen Luethje wrote:
> > > 
> > > Hello Rob and all,
> > > 
> > > in the documentation of dir() it reads:
> > > <quote>
> > > If st names a *directory* you may have entries for "." and ".."
> > > </quote>
> > > 
> > > After my experience, those entries are normally at the _beginning_
> > > of the list which is returned by dir(). Can I rely on the assumption
> > > that this is _always_ the case?
> > > 
> > > Regards,
> > >    Juergen
> > 
> > I suppose you can since the single dot refers to the directory itself and
> > the
> > two dots refer to its parent directory (i.e., the directory that contains
> > it).
> 
> Yes, that is the meaning of those entries. But does their meaning tell us
> anything about the order, in which they are returned by dir()?
> 
> Regards,
>    Juergen

If Craig is not altering the output order... yes. The directory will refer to
itself first and only then to the files contained in it.

JG

new topic     » goto parent     » topic index » view message » categorize

9. Re: "." and ".." returned by dir()

Juergen Luethje wrote:
> 
> Hello Rob and all,
> 
> in the documentation of dir() it reads:
> <quote>
> If st names a *directory* you may have entries for "." and ".."
> </quote>
> 
> After my experience, those entries are normally at the _beginning_
> of the list which is returned by dir(). Can I rely on the assumption
> that this is _always_ the case?
> 
> Regards,
>    Juergen

Hello Juergen,

I always use,

if compare(d[x][1],".")=0 or compare(d[x][1],"..")=0 then
--ignore
end if

So I don't really care about the order.

Don Cole

new topic     » goto parent     » topic index » view message » categorize

10. Re: "." and ".." returned by dir()

don cole wrote:

<snip>

> I always use,
> 
> if compare(d[x][1],".")=0 or compare(d[x][1],"..")=0 then
> --ignore
> end if
> 
> So I don't really care about the order.

Yes, I'm using similar code.
I just had the idea to skip the first 2 elemnts of dir()'s result,
when its argument is a directory that is not the root dir.

When we have ...
object list
list = dir(mydir)
if atom(list) then ... blah, blah ...


... then we could use
for i = 3 to length(list) do


instead of
for i = 1 to length(list) do
   if compare(...


Not soooooo important, I know. :)

Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

11. Re: "." and ".." returned by dir()

Julio C. Galaret Viera wrote:

> Juergen Luethje wrote:

<snip>

>> Yes, that is the meaning of those entries. But does their meaning tell us
>> anything about the order, in which they are returned by dir()?
> 
> If Craig is not altering the output order... yes. The directory will refer to
> itself first and only then to the files contained in it.

I see.

Thanks,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

12. Re: "." and ".." returned by dir()

On Thu, 31 Aug 2006 16:59:51 -0700, "Ricardo M. Forno"
<guest at RapidEuphoria.com> wrote:

>I don't know for shure, but methinks that DOS returns the files and the
>directories ordered by date.
>If this is always true, it might be that you have some files dated earlier
>than the directories where they reside, so this may not be always true.
>This can happen if you create a directory and then you move some files to it.
A quick test showed that false (on win98).
Another quick test I tried kinda proved my theory:
  I created a.txt
  I created b.txt
  I deleted a.txt
  I created c.txt
dir() now lists c before b. Basically, it prints the internal table,
and it (the o/s) won't move files it don't have to. A second quick
test involved my test directory, containing t01..t26; I created a new
subdir, copied all the files into it, deleted t04, created a new file,
and lo and behold, the new file landed in the slot left by t04. (ymmv)

There is a pretty obvious implication for the . and .. entries which
must be created first.

Bottom line is . and .. /will/ (probably) always appear at the top of
dir() [on win98], because there is little/no reason for the os to ever
move them -- but that may not be true on NT/XP/Vista/Linux, etc: the
better bet  is, indeed and of course, to code more safely.

If the hidden question was 'should I run back and modify several dozen
programs which made this assumption?', I'd say no.

Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

13. Re: "." and ".." returned by dir()

Pete Lomax wrote:
> 
> On Thu, 31 Aug 2006 16:59:51 -0700, "Ricardo M. Forno"
> <guest at RapidEuphoria.com> wrote:
> 
> >I don't know for shure, but methinks that DOS returns the files and the
> >directories ordered by date.
> >If this is always true, it might be that you have some files dated earlier
> >than the directories where they reside, so this may not be always true.
> >This can happen if you create a directory and then you move some files to it.
> A quick test showed that false (on win98).
> Another quick test I tried kinda proved my theory:
>   I created a.txt
>   I created b.txt
>   I deleted a.txt
>   I created c.txt
> dir() now lists c before b. 


Now wait a minuet.

I thought files were arranged by the order last selected by View/Arrange
Icons/(name, date etc...) for that window.

If this is not true I'd like to know what is?


Don Cole

new topic     » goto parent     » topic index » view message » categorize

14. Re: "." and ".." returned by dir()

Thanks, Pete!

Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu