[REBOL] Re: dir?
From: joel:neely:fedex at: 30-Jun-2002 16:48
Hi, self,
Don't leave silly loopholes open!
Joel Neely wrote:
> To get a list of sub-directories within someotherdirectory I must
> either "absolutize" the relative file names to someotherdirectory:
>
> for each filename read %someotherdirectory/ [
> if dir? join %someotherdirectory/ filename [print filename]
> ]
>
> or actually change to that directory:
>
> change-dir %someotherdirectory/
> foreach filename read %./ [
> if dir? filename [print filename]
> ]
>
That last example should have been written something like
use [savedir] [
savedir: system/script/path
change-dir %/c/
foreach filename read %./ [
if dir? filename [print filename]
]
change-dir savedir
]
just to follow the principle:
If you move it, put it back when you've finished!
which all good code should follow!
-jn-
--
; Joel Neely joeldotneelyatfedexdotcom
REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip
do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] {
| e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]