Last active
February 5, 2019 04:50
-
-
Save rgchris/f76521beb946050951a09ecb105ab2b0 to your computer and use it in GitHub Desktop.
Return a list of a folder's content (recursive)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rebol [ | |
Title: "Return a listing of a folder's content" | |
Date: 4-Feb-2019 | |
Author: "Christopher Ross-Gill" | |
Rights: http://opensource.org/licenses/Apache-2.0 | |
] | |
deep-list: func [ | |
source [file!] | |
/hidden /folders | |
][ | |
try collect [ | |
for-each file read source [ | |
case [ | |
all [ | |
not hidden | |
parse file ["."] | |
][ | |
; ignore | |
] | |
dir? file [ | |
if folders [ | |
keep/line file | |
] | |
for-each kid deep-list source/:file [ | |
keep/line file/:kid | |
] | |
] | |
file [keep/line file] | |
] | |
] | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment