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

Return Block Of Files, All Dirs First

01.22.2006
| 1492 views |
  • submit to reddit
        
    dir-file-sort: func [
        {Returns the block of files with directories first, followed by
        files, with each group sorted.}
        block [any-block!]
        /local result
    ][
        result: copy []
        foreach blk lib/ser/split block [:dir?] none [
            append result sort blk
        ]
    ]