Jeff / Holger / Everybody,

As a guesture to show my honourable intentions of being a good list member, here's the 
start of some REBOL power tools I started writing recently, this initial batch 
includes directly traversal functions which are currently missing from REBOL.

cheers Guys & here's the code.

Mark Dickson

REBOL [

TITLE: %Power-Tools.r

AUTHOR: "OSCAR"

]

; DIRECTORY TRAVERSAL FUNCTIONS - ROOT-DIR , UP-DIR ,  DOWN-DIR


ROOT-DIR: func ["CHANGES CURRENT PATH TO ROOT DIRECTORY ^/"] [ change-dir %// what-dir 
]



UP-DIR: func [ "MOVES UP ONE LEVEL IN THE DIRECTORY TREE ^/"] [ path: split-path 
what-dir

new-dir: first path

either new-dir = %/ [ change-dir %// what-dir ] [ change-dir new-dir what-dir ]

] 


DOWN-DIR: func [ "MOVES DOWN ONE LEVEL IN THE DIRECTORY TREE ^/" target [string!]] [
    here: what-dir
    path: to-file join here target
    either (dir? path) [change-dir path what-dir] [
        PRINT {NOT A VALID DIRECTORY - PLEASE TRY AGAIN! ^/
HERE IS A LIST OF SUB-DIRECTORIES  
AVAILABLE IN YOUR CURRENT PATH! ^/}
        files: to-block read %.
        dirs: copy []
        foreach file files [either (dir? file) [append dirs file] []]
        foreach dir dirs [print dir]]
]


;   LOTS MORE TO COME SOON



-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to