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 Files In Dir, Fully Qualified

01.22.2006
| 1308 views |
  • submit to reddit
        
    all-files: func [
        {Returns a block of fully qualified filenames 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 [
            f-spec: join spec file
            either all [deep dir? f-spec] [
                all-files/deep f-spec block
            ][
                append block f-spec
            ]
        ]
        block
    ]