PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Identifying the files attributes
  • Modifying the attributes of a file (syntax 2)
  • Managing errors
  • Operating mode in Windows Vista (and later)
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
fAttribute (Function)
In french: fAttribut
Returns or modifies the attributes of a file.
Java In this version, you can only find out the file attributes.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
// Retrieve the attributes of a file
ResAttribute = fAttribute(FilePath + "\File.txt")
IF ResAttribute <> "ERR" THEN
...
END
Syntax

Retrieving the attributes of a file or directory Hide the details

<Result> = fAttribute(<File path>)
<Result>: Character string
  • "ERR" if an error occurred. To find out the error details, use ErrorInfo associated with the errMessage constant.
  • One or more letters corresponding to the file attributes ("AH" for example).
    The following letters are used:
    • R: Read-only file. The file can be accessed in read-only.
    • H: Hidden file. The file name is grayed or invisible in the explorer.
    • S: System file. The file is a Windows system file.
      Java This value is not available.
    • A: "Archive" file. This attribute indicates that the file can be archived. Some programs are using this attribute to find out which files have been saved.
      LinuxJava This value is not supported.
    • D: Directory or sub-directory. The file is a directory or a sub-directory.
    • C: Compressed file (on the NTFS partitions). This file was automatically compressed during its copy on an NTFS partition (Windows NT or 2000).
      Java This value is not available.
    • L: Drive. This name corresponds to the volume name of one of the disks accessible from the computer.
<File path>: Character string (with quotes)
Name and full (or relative) path of file (up to 260 characters). A UNC path can be used.
Versions 15 and later
WindowsLinux This parameter can be in Ansi or Unicode format.
New in version 15
WindowsLinux This parameter can be in Ansi or Unicode format.
WindowsLinux This parameter can be in Ansi or Unicode format.
WINDEVUser code (UMC)

Modifying the attributes of a file or directory Hide the details

<Result> = fAttribute(<File path> , <File attributes>)
<Result>: Character string
  • "ERR" if an error occurred. To find out the error details, use ErrorInfo associated with the errMessage constant.
  • One or more letters corresponding to the new attributes of the file ("AH" for example):. The following letters are used:
    • R: Read-only file. The file can be accessed in read-only.
    • H: Hidden file. The file name is grayed or invisible in the explorer.
    • S: System file. The file is a Windows system file.
    • A: "Archive" file. This attribute indicates that the file can be archived. Some programs are using this attribute to find out which files have been saved.
    • D: Directory or sub-directory. The file is a directory or a sub-directory.
    • C: Compressed file (on the NTFS partitions). This file was automatically compressed during its copy on an NTFS partition (Windows NT or 2000).
<File path>: Character string (with quotes)
Name and full (or relative) path of file (up to 260 characters). A UNC path can be used.
Versions 15 and later
WindowsLinux This parameter can be in Ansi or Unicode format.
New in version 15
WindowsLinux This parameter can be in Ansi or Unicode format.
WindowsLinux This parameter can be in Ansi or Unicode format.
<File attributes>: Character string (with quotes)
One or more letters corresponding to the new attributes of the specified file ("AH" for example). The order of the letters has no importance. The following letters are used:
  • R: Read-only file. The file can be accessed in read-only.
  • H: Hidden file. The file name is grayed or invisible in the explorer.
  • S: System file. The file is a Windows system file.
  • A: "Archive" file. This attribute indicates that the file can be archived. Some programs are using this attribute to find out which files have been saved.
  • "" (empty string). All the attributes are disabled.
Remarks

Identifying the files attributes

To retrieve the different attributes of a file, check whether one of the letters identifying an attribute is found in <Result>. This search can be performed by Position for example.
WINDEVUser code (UMC)

Modifying the attributes of a file (syntax 2)

After modification, the attributes of the file correspond to the attributes specified by fAttribute. For example, if <File attributes> corresponds to "AR", the specified file will become a read-only archive file.
Special cases:
  • Modifying a directory or a sub-directory: the "Directory or sub-directory" attribute (letter D) cannot be modified. Regardless of the modification performed, the directory (or the sub-directory) will keep the "Directory and sub-directory" attribute (letter D).
  • Modifying a compressed file (on the NTFS partitions): the "Compressed file" attribute (letter C) cannot be modified. Regardless of the modification performed, the compressed file will keep the "Compressed file" attribute (letter C).

Managing errors

fAttribute generates an error in the following cases:
  • the specified file does not exist,
  • the name of the specified file is invalid,
  • the specified file is opened or locked by another application (when modifying the attributes only),
  • the letters specified in <File attributes> do not correspond to file attributes.
  • a Unicode string was used for <File name> in an operating system such as Windows 98 or Windows Me.
WINDEVUser code (UMC)

Operating mode in Windows Vista (and later)

If this function does not operate properly in Windows Vista (and later), check whether the file or directory used is not in one of the system directories (Windows directory or "Program Files" directory).
Indeed, in Windows Vista (and later), with the UAC mechanism (User Account Control) enabled, you must have the administrator privileges to handle and/or modify the files or directories in the system directories (Windows directory or "Program Files" directory).
Programming tip: To handle and/or modify the files or directories without administrator privileges, you should:
  • avoid writing into the Windows directory or into the "Program Files" directory,
  • use the system directory corresponding to the application (returned by SysDir associated with the srCommonAppData constant).
Component : wd240std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment