From: Steve Tuckner Date: 2002-01-12T05:05:51+09:00 Subject: RE: Dir.entries have no home This is a very legitimate concern. I have wanted to know which files have changed in a particular directory since a certain date. Now with a the standard Dir[] message, I can get a list of files in the given directory, then I have to call File.stat for each file. On a Windows system with a lot of files in directory (say 3000), this takes a looooooooong time. If I do a system("dir") it is much faster but hardly and elegant solution. Another solution would be to write a C extension to call Win32 FindFirst, and FindNext functions and return a Filename or DirEntry object. Maybe the best way to approach this is to have Dir[] return a File object that you can send a message to get the information you want without consulting the file system. That is if the file object has been created with meta data associated with it (ie. Mod Time, etc), then it should be available without consulting the file system and if not the file system can be consulted to get that information. This does bring up the problem of the file's meta data changing without the File object knowing about it. Just my $0.02 Steve Tuckner -----Original Message----- From: Ron Jeffries [mailto:ronjeffries@REMOVEacm.org] Sent: Friday, January 11, 2002 1:45 PM To: ruby-talk ML; undisclosed-recipients: Subject: Re: Dir.entries have no home Thanks David and Massimilano for your interesting and helpful replies. Looks like I should get 1.7. Is it pretty stable as such things go? Where I was really going, though, was to a different issue. I'm suggesting that the objects involved in the Dir.entries, FileTest, and File families aren't quite right. Think of it this way: When I do Dir.entries, I expect objects back that represent, you guessed it, entries in the directory. But in fact I get strings, and they don't represent much of anything other than the names of the files in the directory and they aren't even the full names of those. I'd like to be able to ask questions of directory entries, like are you a directory, what is your last-written date, and so on. I can't ask those strings those questions, so I am invited to useFileTest, a module (indistinguishable from a class in this sense) and send messages to FileTest, passing in the strings, which are not even the strings that I got from Dir.entries, but instead strings with a bunch of concatentation of directory names and slashes and whatnot. I mean this in the nicest possible way, but I have the impression that in the Ruby/Python/Perl universe we are used to dealing with system level things not as objects encapsulating information and supporting methods for doing things, but as strings. I'm wondering if there is, or should be, a movement to bring Ruby more in lines with the principles of objects. Or am I just wasting my time worrying about this? Thanks, Ronald E Jeffries http://www.XProgramming.com http://www.objectmentor.com I'm giving the best advice I have. You get to decide whether it's true for you.