PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • 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.
AndroidAndroid Widget JavaPHP In this version, you can only find out the file attributes.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget 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.
      PHP This value is not available.
    • S: System file. The file is a Windows system file.
      AndroidAndroid Widget JavaPHP 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.
      LinuxAndroidAndroid Widget iPhone/iPadJavaPHP 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).
      AndroidAndroid Widget JavaPHP This value is not available.
    • L: Drive. This name corresponds to the volume name of one of the disks accessible from the computer.
      Windows MobilePHP This value is not available.
<File Path>: Character string (with quotes)
Name and full (or relative) path of file (up to 260 characters). A UNC path can be used.
Windows Mobile This path must be a full path or a UNC path. It cannot be a relative path.
Versions 15 and later
WindowsLinux This parameter can be in Ansi or Unicode format.
AndroidAndroid Widget This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: In Android, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories, as well as onto the external memory (SDCard).
New in version 15
WindowsLinux This parameter can be in Ansi or Unicode format.
AndroidAndroid Widget This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: In Android, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories, as well as onto the external memory (SDCard).
WindowsLinux This parameter can be in Ansi or Unicode format.
AndroidAndroid Widget This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: In Android, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories, as well as onto the external memory (SDCard).
Versions 17 and later
iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
New in version 17
iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileAjaxUser 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.
Windows Mobile Name and full path of the file (up to 260 characters).
Versions 17 and later
iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
New in version 17
iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
<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.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileAjaxUser 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.
WINDEVWEBDEV - Server codeReports and QueriesUser 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 used is not found 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 found in the system directories (Windows directory or "Program Files" directory).
Programming tip: To handle and/or modify the files without having 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).
Components
WINDEVWEBDEV - Server codeReports and Queries wd230std.dll
Windows Mobile wp230std.dll
Java wd230java.jar
Linux wd230std.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment