Sets the attributes for a file or directory.

SetFileAttributes(cFileName, nAttributes)

Parameters

cFileName

The name of the file for which to set the attributes.

Note

This can be a relative path or only a filename, the VFP function FULLPATH is used to retrieve the fully qualified filename.
The usual VFP search path (SET PATH) is used.

nAttributes (additional)
One or a combination of the following values.
AttributeDescription
FILE_ATTRIBUTE_ARCHIVEA file or directory that is an archive file or directory. Applications typically use this attribute to mark files for backup or removal.
FILE_ATTRIBUTE_HIDDENThe file or directory is hidden. It is not included in an ordinary directory listing.
FILE_ATTRIBUTE_NORMALA file that does not have other attributes set. This attribute is valid only when used alone.
FILE_ATTRIBUTE_NOT_CONTENT_INDEXEDThe file or directory is not to be indexed by the content indexing service.
FILE_ATTRIBUTE_OFFLINEThe data of a file is not available immediately. This attribute indicates that the file data is physically moved to offline storage. This attribute is used by Remote Storage, which is the hierarchical storage management software. Applications should not arbitrarily change this attribute.
FILE_ATTRIBUTE_READONLYA file that is read-only. Applications can read the file, but cannot write to it or delete it. This attribute is not honored on directories.
FILE_ATTRIBUTE_SYSTEMA file or directory that the operating system uses a part of, or uses exclusively.
FILE_ATTRIBUTE_TEMPORARYA file that is being used for temporary storage. File systems avoid writing data back to mass storage if sufficient cache memory is available, because typically, an application deletes a temporary file after the handle is closed. In that scenario, the system can entirely avoid writing the data. Otherwise, the data is written after the handle is closed.

Return Value

Always .T.

See Also

Reference

ADirectoryInfo
ADirEx
ADriveInfo
AFileAttributes
AFileAttributesEx
CancelFileChange
CompareFileTimes
CopyFileEx
DeleteDirectory
DeleteFileEx
FindFileChange
GetFileAttributes
GetFileOwner
GetFileSize
GetFileTimes
GetLongPathName
GetShortPathName
MoveFileEx
SetFileTimes

Used WinApi functions

SetFileAttributes