Bob Alexander wrote: > > On the topic of whether ".." and "." should be in our directory > listings: > > I don't think it really matters that those entries really exist in the > OS directory structure. What matters is what is useful in a programming > context. The ".." and "." entries are "bookkeeping" entries, > implementation artifacts. How often when scanning a directory do you > really want to see them? The directory contents are really the files and > directories in them. The parent and self directory are not really > "contents", even though technically they appear in the directory. > > Note that the Unix "ls" command omits them by default. > > Both Java and Python omit them from their directory listing methods. > > It is a nuisance to almost always have to explicitly skip them when > scanning a directory: > > for entry in Dir.entries("myDir") > next if ["..", "."].include?(entry) > ... > end > > Can someone suggest an argument as to why having them in the listed > entries is useful? > I often use ls -al in the shell because I also need to see the permissions and/or owner of '.' And it is useful in the shell to use '..' as a navigation tool. But when I programmatically iterate over directory entries, I don't care about '.' or '..' I use Dir["*"] to avoid them being included. Guy N. Hurst