1. "." and ".." returned by dir()
- Posted by Juergen Luethje <j.lue at gmx.de> Aug 31, 2006
- 629 views
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
2. Re: "." and ".." returned by dir()
- Posted by Ricardo M. Forno <rmforno at tutopia.com> Aug 31, 2006
- 602 views
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.
3. Re: "." and ".." returned by dir()
- Posted by Robert Craig <rds at RapidEuphoria.com> Aug 31, 2006
- 614 views
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
4. Re: "." and ".." returned by dir()
- Posted by Juergen Luethje <j.lue at gmx.de> Aug 31, 2006
- 627 views
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
5. Re: "." and ".." returned by dir()
- Posted by Julio C. Galaret Viera <galaret at adinet.com.uy> Aug 31, 2006
- 642 views
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
6. Re: "." and ".." returned by dir()
- Posted by Julio C. Galaret Viera <galaret at adinet.com.uy> Aug 31, 2006
- 632 views
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
7. Re: "." and ".." returned by dir()
- Posted by Juergen Luethje <j.lue at gmx.de> Aug 31, 2006
- 633 views
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
8. Re: "." and ".." returned by dir()
- Posted by Julio C. Galaret Viera <galaret at adinet.com.uy> Aug 31, 2006
- 626 views
- Last edited Sep 01, 2006
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
9. Re: "." and ".." returned by dir()
- Posted by don cole <doncole at pacbell.net> Aug 31, 2006
- 634 views
- Last edited Sep 01, 2006
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
10. Re: "." and ".." returned by dir()
- Posted by Juergen Luethje <j.lue at gmx.de> Sep 01, 2006
- 594 views
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
11. Re: "." and ".." returned by dir()
- Posted by Juergen Luethje <j.lue at gmx.de> Sep 01, 2006
- 587 views
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
12. Re: "." and ".." returned by dir()
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Sep 02, 2006
- 596 views
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
13. Re: "." and ".." returned by dir()
- Posted by don cole <doncole at pacbell.net> Sep 02, 2006
- 599 views
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
14. Re: "." and ".." returned by dir()
- Posted by Juergen Luethje <j.lue at gmx.de> Sep 03, 2006
- 623 views
Thanks, Pete! Regards, Juergen