AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de archivos externos
  • Identifying the files attributes
  • Modifying the attributes of a file (syntax 2)
  • Handling errors
  • Operating mode in Windows Vista (and later)
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Returns or modifies the attributes of a file.
AndroidWidget Android JavaPHP In this version, you can only find out the file attributes.
// Retrieve the attributes of a file
ResAttribute = fAttribute(FilePath + "\File.txt")
IF ResAttribute <> "ERR" THEN
...
END
Sintaxis

Retrieving the attributes of a file or directory Ocultar los detalles

<Result> = fAttribute(<File path>)
<Result>: Character string
  • "ERR" if an error occurred. To get more details on the error, use ErrorInfo 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.
      AndroidWidget Android JavaPHP This value is not available.
    • A: "Archive" file. This attribute indicates that the file can be archived. Some programs use this attribute to determine which files have been saved.
      LinuxAndroidWidget Android iPhone/iPadIOS WidgetMac CatalystJavaPHP This value is not supported.
    • D: Directory or sub-directory. The file is a directory or a subdirectory.
    • C Compressed file (on NTFS partitions). This file was automatically compressed during its copy on an NTFS partition (Windows NT or 2000).
      AndroidWidget Android JavaPHP This value is not available.
    • L: Reader. This name corresponds to the volume name of one of the disks accessible from the computer.
      PHP This value is not available.
<File path>: Character string
Name and full or relative path of the file (up to 260 characters). A UNC path can be used.
WindowsLinux This parameter can be in Ansi or Unicode format.
AndroidWidget Android This parameter can correspond to a full path or a path relative 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 can only write to its installation directory or one of its subdirectories, as well as to the external memory (SDCard).
iPhone/iPadIOS WidgetMac Catalyst This parameter can correspond to a full path or a path relative to the current directory (returned by fCurrentDir). This parameter is case-sensitive.
Reminder Under iPhone/iPad, on both the device and the emulator, the file system is read-only. An application can only write to its installation directory or one of its subdirectories.
WINDEVWEBDEV - Código ServidorReportes y ConsultasiPhone/iPadIOS WidgetMac CatalystCódigo de Usuario (UMC)Ajax

Modifying the attributes of a file or directory Ocultar los detalles

<Result> = fAttribute(<File path> , <File attributes>)
<Result>: Character string
  • "ERR" if an error occurred. To get more details on the error, use ErrorInfo 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 use this attribute to determine which files have been saved.
    • D: Directory or sub-directory. The file is a directory or a subdirectory.
    • C Compressed file (on NTFS partitions). This file was automatically compressed during its copy on an NTFS partition (Windows NT or 2000).
<File path>: Character string
Name and full or relative path of the file (up to 260 characters). A UNC path can be used.
WindowsLinux This parameter can be in Ansi or Unicode format.
iPhone/iPadIOS WidgetMac Catalyst This parameter can correspond to a full path or a path relative to the current directory (returned by fCurrentDir). This parameter is case-sensitive.
Reminder Under iPhone/iPad, on both the device and the emulator, the file system is read-only. An application can only write to its installation directory or one of its subdirectories.
<File attributes>: Character string
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 use this attribute to determine which files have been saved.
  • "" (empty string). All the attributes are disabled.
Observaciones

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 - Código ServidorReportes y ConsultasiPhone/iPadIOS WidgetMac CatalystCódigo de Usuario (UMC)Ajax

Modifying the attributes of a file (syntax 2)

Once modified, the attributes of the file correspond to the attributes specified with 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 subdirectory: the "Directory or subdirectory" attribute (letter D) cannot be modified. Regardless of the modification performed, the directory (or the subdirectory) will keep the "Directory and subdirectory" attribute (letter D).
  • Modifying a compressed file (on 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).

Handling errors

fAttribute throws 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.
WINDEVWEBDEV - Código ServidorReportes y ConsultasCódigo de Usuario (UMC)

Operating mode in Windows Vista (and later)

If this function does not work 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).
In Windows Vista (and later), with the UAC mechanism (User Account Control) enabled, you must have administrator privileges to handle and/or modify the files or directories in system directories (Windows directory or "Program Files" directory).
Programming tip: If you need to manipulate / modify files or directories, without needing administrator privileges, it is advisable:
  • avoid writing to the Windows directory or to the "Program Files" directory,
  • use the system directory of the application (returned by SysDir with the srAppDataCommun constant, for example).
Componente: wd300std.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local