Re: walk_dir issue
- Posted by Derek Parnell <ddparnell at bigpond.com> Nov 24, 2004
- 535 views
Robert Craig wrote: > > Juergen Luethje wrote: > > That was not my question. My point was, that when we do e.g. > > }}} <eucode> > > ? walk_dir("C:\\*.txt", routine_id("look_at"), 0) > > </eucode> {{{ > > > > -- as I wrote above -- then something happens, that Derek and I > > consider a bug. > > I'm not sure why this is a bug. > You are supposed to specify a single directory for walk_dir() > to walk. You are instead specifying a bunch of txt files. > How can you complain about what happens next? Do you > want walk_dir() to analyse the path you give it, and spit out > an error message? > This is an example of the very helpful nature of RDS that is causing me to go. There is a bug. And this is it. The documentation states 'This routine will "walk" through a directory with path name given by st.' The 'st' I take is meant to be a directory (folder) name. Okay. That's fine and I have no problem with that idea. So why does walk_dir() call my suppied routine with file names if I call it with a directory name of "c:\\*.txt" when there is no directory called "*.txt" in my C: drive? My first attempt to fix this issue was to add these lines at the beginning of walk_dir() ... if path_name[$] != SLASH then path_name &= SLASH end if thus forcing the 'st' parameter to be a directory specification. However, this lead to another issue. It turns out that the dir() function has a bug in it. dir() does not recognise that a specification that ends in a SLASH is supposed to be a directory specification. I think that this is a bug because both DOS and Unix does not behave this way. If I do ? dir("c:\\*.txt\\") I get a set of entries in the returned sequence instead of getting a -1 returned. This is what I get in DOS ... ====================== c:\temp>dir c:\*.txt\ The filename, directory name, or volume label syntax is incorrect. c:\temp>dir c:\*.txt Volume in drive C is Local Volume Serial Number is AAAA-AAAA Directory of c:\ 03/08/2004 06:42 PM 1,084 certreq.txt 06/11/2002 03:59 PM 818 contacts.txt 11/07/2003 06:21 PM 369 FREQ.TXT 08/04/2003 04:09 PM 1,608 KillList.txt 02/06/2004 03:19 PM 1,218,133 OPFLog_02_06_2004.txt 07/06/2004 12:35 PM 1,053,704 OPFLog_07_06_2004.txt 18/05/2004 01:33 PM 516 OPFLog_18_05_2004.txt 15/07/2003 06:59 PM 5 RANDSEED.TXT 16/10/2001 02:01 PM 57 WINNTnwstatus.txt ====================== and this is what I get in Unix ... ========================= wilma:/u5/users/derekp> ls *.txt/ ls: *.txt/ not found: No such file or directory (error 2) wilma:/u5/users/derekp> ls *.txt sec.txt tempsrc.txt ====================== Thus, I believe that dir() has a bug in it that prevents a simple fix for the bug in walk_dir() working. Thank's for your support, Robert. -- Derek Parnell Melbourne, Australia