1. walk_dir issue
I'm not sure if this is a bug or design feature but if you pass
a path with wildcards to walk_dir, the routine_id that it calls
receives a Path parameter with the wildcard specification included.
For example:
res = walk_dir("C:\\temp\\test.*", routine_id("dirfunc"), 1)
Then the routine 'dirfunc' gets "C:\temp\test.*" in the path name
parameter. I was expecting it to get "C:\temp" instead.
--
Derek Parnell
Melbourne, Australia
2. Re: walk_dir issue
Derek Parnell wrote:
>
> I'm not sure if this is a bug or design feature but if you pass
> a path with wildcards to walk_dir, the routine_id that it calls
> receives a Path parameter with the wildcard specification included.
>
> For example:
>
> res = walk_dir("C:\\temp\\test.*", routine_id("dirfunc"), 1)
>
> Then the routine 'dirfunc' gets "C:\temp\test.*" in the path name
> parameter. I was expecting it to get "C:\temp" instead.
>
> --
> Derek Parnell
> Melbourne, Australia
>
Actually, the docs state "This routine will "walk" through a directory
with path name given by st." It expects a path name and doesn't say
anything about supporting wildcard searches. I don't think putting
wildcard specs in your PATH environment varible works either (but I
haven't bothered checking).
-- Brian
3. Re: walk_dir issue
Derek Parnell wrote:
> I'm not sure if this is a bug or design feature but if you pass
> a path with wildcards to walk_dir, the routine_id that it calls
> receives a Path parameter with the wildcard specification included.
>
> For example:
>
> res = walk_dir("C:\\temp\\test.*", routine_id("dirfunc"), 1)
>
> Then the routine 'dirfunc' gets "C:\temp\test.*" in the path name
> parameter. I was expecting it to get "C:\temp" instead.
To me it looks like a design feature. In 'lib_u_z.htm#walk_dir' it
reads: "... directory with path name given by st."
"C:\\temp\\test.*" is not a valid path name on DOS/Windows because of
the '*' that it contains.
Regards,
Juergen
4. Re: walk_dir issue
i use the dir95.e lib to get a list of files of the directory and return it to a
sequence which i then loop through.
excerpt from my conversion program.
include dir95.e
sequence vbetfname,vbettype,currentfileloc,currentfile,mm,dd,yy,cc,yyyy
--cannot use the walk_dir statement, have to process in reverse order
vbetlst = "c:\\versabet\\*.lst"
vbetdirlist = sort(dir(vbetdir))
for i = allfiles to 3 by -1 do
currentfile = lower(vbetdirlist[i][D_NAME])
fsize = vbetdirlist[i][D_SIZE]
vbetfname = currentfile[1..length(currentfile)-4]
vbettype = currentfile[length(currentfile)-3..length(currentfile)]
currentfileloc = vbetdir & currentfile
rudy
5. Re: walk_dir issue
Brian Broker wrote:
>
> Derek Parnell wrote:
> >
> > I'm not sure if this is a bug or design feature but if you pass
> > a path with wildcards to walk_dir, the routine_id that it calls
> > receives a Path parameter with the wildcard specification included.
> >
> > For example:
> >
> > res = walk_dir("C:\\temp\\test.*", routine_id("dirfunc"), 1)
> >
> > Then the routine 'dirfunc' gets "C:\temp\test.*" in the path name
> > parameter. I was expecting it to get "C:\temp" instead.
> >
> > --
> > Derek Parnell
> > Melbourne, Australia
> >
>
> Actually, the docs state "This routine will "walk" through a directory
> with path name given by st." It expects a path name and doesn't say
> anything about supporting wildcard searches.
I misunderstood. I thought a path was a set of directories that form
a hierarchy and that specifies the location of a file. Thus the file
specification "c:\temp\test.*" gives us the path of "c:\temp".
My mistake obviously.
However, using your understanding instead, it must be a bug, because walk_dir
calls my user routine for each file that matches "test.*" in the
path (directory) "c:\temp". If the first parameter is supposed to be a
directory specification then I would expect that the user-defined routine
would not be called at all because no such directory as "c:\temp\test.*"
exists.
> I don't think putting
> wildcard specs in your PATH environment varible works either (but I
> haven't bothered checking).
And there is a point to that comment? Are you trying to insinuate that
I'm too stupid to understand the documentation. Well it looks like you
may very well be correct. I am now all embarrassed to have troubled
your pretty little head with my tribulations. A thousand pardons sir.
--
Derek Parnell
Melbourne, Australia
6. Re: walk_dir issue
Juergen Luethje wrote:
>
> Derek Parnell wrote:
>
> > I'm not sure if this is a bug or design feature but if you pass
> > a path with wildcards to walk_dir, the routine_id that it calls
> > receives a Path parameter with the wildcard specification included.
> >
> > For example:
> >
> > res = walk_dir("C:\\temp\\test.*", routine_id("dirfunc"), 1)
> >
> > Then the routine 'dirfunc' gets "C:\temp\test.*" in the path name
> > parameter. I was expecting it to get "C:\temp" instead.
>
> To me it looks like a design feature. In 'lib_u_z.htm#walk_dir' it
> reads: "... directory with path name given by st."
>
> "C:\\temp\\test.*" is not a valid path name on DOS/Windows because of
> the '*' that it contains.
>
In that case its a bug, because it calls my user-defined routine for
each matching file in c:\temp.
--
Derek Parnell
Melbourne, Australia
7. Re: walk_dir issue
rudy toews wrote:
>
>
> i use the dir95.e lib to get a list of files of the directory and return it to
> a sequence
> which i then loop through.
I thought I'd be a good boy and not re-invent the wheel again. So I
decided to use one of the supplied-by-RDS routines. Sure I could
have done it using a home-brew routine, and maybe I should have.
--
Derek Parnell
Melbourne, Australia
8. Re: walk_dir issue
Derek Parnell wrote:
>
> Brian Broker wrote:
> >
> > Derek Parnell wrote:
> > >
> > > I'm not sure if this is a bug or design feature but if you pass
> > > a path with wildcards to walk_dir, the routine_id that it calls
> > > receives a Path parameter with the wildcard specification included.
> > >
> > > For example:
> > >
> > > res = walk_dir("C:\\temp\\test.*", routine_id("dirfunc"), 1)
> > >
> > > Then the routine 'dirfunc' gets "C:\temp\test.*" in the path name
> > > parameter. I was expecting it to get "C:\temp" instead.
> > >
> >
> > Actually, the docs state "This routine will "walk" through a directory
> > with path name given by st." It expects a path name and doesn't say
> > anything about supporting wildcard searches.
>
> I misunderstood. I thought a path was a set of directories that form
> a hierarchy and that specifies the location of a file. Thus the file
> specification "c:\temp\test.*" gives us the path of "c:\temp".
> My mistake obviously.
>
> However, using your understanding instead, it must be a bug, because walk_dir
> calls my user routine for each file that matches "test.*" in the
> path (directory) "c:\temp". If the first parameter is supposed to be a
> directory specification then I would expect that the user-defined routine
> would not be called at all because no such directory as "c:\temp\test.*"
> exists.
I think that 'path' is somewhat ambiguous, in that a path can be a file
or a directory. If you take a look at file.e, you'll see that (unless
you change my_dir) it calls dir() on your path, so wildcards will be
used on Win32 and DOS. It's possible to have a directory named
"c:\temp\test.123\", so I think that the current behavior is correct.
> > I don't think putting
> > wildcard specs in your PATH environment varible works either (but I
> > haven't bothered checking).
>
> And there is a point to that comment? Are you trying to insinuate that
> I'm too stupid to understand the documentation. Well it looks like you
> may very well be correct. I am now all embarrassed to have troubled
> your pretty little head with my tribulations. A thousand pardons sir.
Sheesh. Bad day at work?
Matt Lewis
9. Re: walk_dir issue
Derek Parnell wrote:
> Juergen Luethje wrote:
>>
>> Derek Parnell wrote:
>>
>>> I'm not sure if this is a bug or design feature but if you pass
>>> a path with wildcards to walk_dir, the routine_id that it calls
>>> receives a Path parameter with the wildcard specification included.
>>>
>>> For example:
>>>
>>> res = walk_dir("C:\\temp\\test.*", routine_id("dirfunc"), 1)
>>>
>>> Then the routine 'dirfunc' gets "C:\temp\test.*" in the path name
>>> parameter. I was expecting it to get "C:\temp" instead.
>>
>> To me it looks like a design feature. In 'lib_u_z.htm#walk_dir' it
>> reads: "... directory with path name given by st."
>>
>> "C:\\temp\\test.*" is not a valid path name on DOS/Windows because of
>> the '*' that it contains.
>
> In that case its a bug, because it calls my user-defined routine for
> each matching file in c:\temp.
Oops.. yes, of course.
According to the documentation, walk_dir() should raise an error and
display a message such as "'C:\\temp\\test.*' is not a valid path name."
(at least on DOS/Windows).
On the other hand, if it is intended that the first parameter of
walk_dir may contain wildcards (I would appreciate that), then the
documentation should be changed, and the walk_dir() function must be
changed in this case, too.
Regards,
Juergen
10. Re: walk_dir issue
- Posted by Derek Parnell <ddparnell at bigpond.com>
Oct 19, 2004
-
Last edited Oct 20, 2004
Matt Lewis wrote:
>
> Sheesh. Bad day at work?
Like you wouldn't believe! It's now morning and I've had a nice breakfast, the
sun is shining, the birds are singing, all is well with the world again.
--
Derek Parnell
Melbourne, Australia