Skip to content

Instantly share code, notes, and snippets.

@rebolek
Created July 4, 2018 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rebolek/23ece25ced5701c98359f5051f2b2033 to your computer and use it in GitHub Desktop.
Save rebolek/23ece25ced5701c98359f5051f2b2033 to your computer and use it in GitHub Desktop.
Red[]
parse-ll: func [dir][
out: copy []
fileinfo!: context [
name: none
size: none
date: none
type: none
]
call/wait/output rejoin ["ls -la " dir] out: copy {}
dir-files: split out newline
foreach file dir-files [
data: split file space
fileinfo: make fileinfo! [
type: switch first first data [#"-" ['file] #"d" ['directory] #"l" ['link]]
name: data/9
]
if fileinfo/type = 'file [fileinfo/size: data/5]
append out fileinfo
]
out
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment