Rebol Programming/dir?

From Wikibooks, open books for an open world
Jump to navigation Jump to search

USAGE:[edit | edit source]

DIR? target 

DESCRIPTION:[edit | edit source]

Returns TRUE if a file or URL is a directory.

DIR? is a function value.

ARGUMENTS[edit | edit source]

  • target -- (Type: file url)

(SPECIAL ATTRIBUTES)[edit | edit source]

  • catch

SOURCE CODE[edit | edit source]

dir?: func [
    "Returns TRUE if a file or URL is a directory." 
    [catch] 
    target [file! url!] 
    /local info
][
    info: throw-on-error [info? target] 
    either none? info [false] [info/type = 'directory]
]