DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Get All Sub-directories

01.22.2006
| 3273 views |
  • submit to reddit
        
    dirs: func [
        {Returns a block of fully qualified subdirectories for the directory.}
        spec  [file!]   "Starting directory"
        block [block!]  "Block to append to"
        /deep           "Recurse sub-directories."
        /local f-spec
    ][
        spec: dirize spec
        foreach file read spec [
            if dir? f-spec: join spec file [
                append block f-spec
                if deep [all-dirs/deep f-spec block]
            ]
        ]
        block
    ]