XbZ_SetFileAttributes()
Previous  Top  Next

XbZ_SetFileAttributes() - Set/Change File Attributes of File or Directory on Disk.

Syntax

XbZ_SetFileAttributes(<cFileName>,  
                      <cFileAttrib>) --> lSuccess  

Parameters

<cFileName>  
<cFileName> contains the (relative or fully qualified) File Name (with or without Path) of the File that should be changed. If no Path or a relative Path is given, the file is searched for in the Current Directory of the Current Drive or in the given relative path from the Current Directory of the Current Drive.  

<cFileAttrib>  
<cFileAttrib> contains the new File Attributes that should be set for <cFileName>. Possible values are any combination of the following four letters: "RASH", or an empty string.  

Returns

This functions returns .T. (TRUE) if the File Attributes of <cFileName> were successfully changed to <cFileAttrib> or .F. (FALSE) if not.  

Description

This functions changes the File Attributes of <cFileName> to the specified <cFileAttrib> value. and returns the success status of the operation.  
 
NOTE: This function works ONLY for the following File Attributes: "R" (Read-Only), "H" (Hidden), "S" (System), and "A" (Archive). It DOES NOT work for "D" (Directory) or "V" (Volume) or any other letters! The supported File Attributes are ONLY valid for MS DOS and Windows (FAT/VFAT/NTFS)!  
 
This is basically a wrapper function for the "Kernel32.dll" DLL Function: SetFileAttributes().  

Example

Set the File Attributes of file "C:\Test\TestFile.abc" to "Hidden", "System" and "Archive":  

LOCAL cFileName := 'C:\Test\TestFile.abc'  
LOCAL lSuccess  := XbZ_SetFileAttributes(cFileName, 'HSA')