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

[REBOL] Re: Aquiring sub-dir contents

From: chris:ross-gill at: 4-Oct-2001 18:19

Hi Donald,
> Is there a small, simple method (or function) of getting just the > file names within a set of sub-drawers? I am having trouble > efficiently applying what little directory code there is, in the web > database. > > The parent directory has a set of drawers named (-, A, B, C..., 1, 2, > 3...), but the code should work universally with any name set. The > goal, of course, is to get only the file names within the drawer set, > not the drawer names.
This might be a useful starting point. Usage: recurse-read ; prints all filenames in the current folder ; including subfolders recurse-read/sub %a/ ; prints all filenames in %a/ and it's subfolders - Chris -- REBOL [] recurse-read: func [ /sub dir [file! url!] /local files [block!] ][ either sub [ dir: dirize dir files: sort read dir ][ dir: %"" files: sort read %. ] foreach file files [ either dir? join dir file [ recurse-read/sub join dir file ][ print rejoin [dir file] ] ] ]