Jump to main content

##

# 1.2.7.4.35 SYS_FS_FileDirectoryModeSet Function

## C

    SYS_FS_RESULT SYS_FS_FileDirectoryModeSet
    (
        const char* path,
        SYS_FS_FILE_DIR_ATTR attr,
        SYS_FS_FILE_DIR_ATTR mask
    );

## Summary

Sets the mode for the file or directory.

## Description

This function sets the mode for a file or directory from the specified list of attributes.

## Precondition

The file or directory for which the mode is to be set must exist.

## Parameters

Param | Description
--- | ---
path | Path for the file/directory, for which the mode is to be set.
attr | Attribute flags to be set in one or more combination of the type SYS_FS_FILE_DIR_ATTR. The specified flags are set and others are cleared.
mask | Attribute mask of type SYS_FS_FILE_DIR_ATTR that specifies which attribute is changed. The specified attributes are set or cleared.

## Returns

SYS_FS_RES_SUCCESS - Mode set operation was successful.

SYS_FS_RES_FAILURE - Mode set operation was unsucessful. The reason for the failure can be retrieved with SYS_FS_Error.

## Example

    // Set read-only flag, clear archive flag and others are retained.
    SYS_FS_FileDirectoryModeSet("file.txt", SYS_FS_ATTR_RDO, SYS_FS_ATTR_RDO | SYS_FS_ATTR_ARC);

## Remarks

None.