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 File Attributes

  • submit to reddit
    attr: func [
        {Return current attributes for the file.}
        file [file!]
        /with   {Retrieve only selected attributes.}
            sel {Selected attributes to retrieve.}
        /avail  {Return a list of attributes available for the file.}
        /copy   {Copy all attributes, which are safe to copy, to f2.}
            f2 [file!]
        /local a
        if with  [return get-modes file sel]
        if avail [return get-modes file 'file-modes]
        if copy  [
            ;set-modes f2 a: get-modes file get-modes file 'copy-modes
            ; Core 2.5 includes full-path, which it shouldn't
            ;set-modes f2 a: get-modes file exclude get-modes file 'copy-modes [full-path]
            set-modes f2 a: get-modes file get-modes file 'copy-modes
            return a
        get-modes file get-modes file 'file-modes