Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Iam a Good Guy Now!

From: robbo1mark:aol at: 19-Feb-2001 11:48

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