FILEATTRIB Get and Set File or Directory Attributes

Section: Operating System Functions

Usage

Retrieves information about a file or directory. The first version uses the syntax
   y = fileattrib(filename)

where filename is the name of a file or directory. The returned structure contains several entries, corresponding to the attributes of the file. Here is a list of the entries, and their meaning:

You can also provide a wildcard filename to get the attributes for a set of files e.g.,
   y = fileattrib('foo*')

You can also use fileattrib to change the attributes of a file and/or directories. To change attributes, use one of the following syntaxes

   y = fileattrib(filename,attributelist)
   y = fileattrib(filename,attributelist,userlist)
   y = fileattrib(filename,attributelist,userlist,'s')

where attributelist is a string that consists of a list of attributes, each preceeded by a + to enable the attribute, and - to disable the attribute. The valid list of attributes that can be changed are

for example, '-w +r' would indicate removal of write permissions and addition of read permissions. The userlist is a string that lists the realm of the permission changes. If it is not specified, it defaults to 'u'. Finally, if you specify a 's' for the last argument, the attribute change is applied recursively, so that setting the attributes for a directory will apply to all the entries within the directory.