ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions
  • Example 1: Retrieving attributes from a file
fAttribute (Example)
Example 1: Retrieving attributes from a file
The following code is used to find out the attributes of a file.
// Declare and initialize the variables
ResAttribute is string
FilePath is string
FileAtt is string = "The file is:"
// Attributes of the file?
ResAttribute = fAttribute(FilePath)
IF ResAttribute <> "ERR" THEN
IF Position(ResAttribute, "A") THEN FileAtt = FileAtt + CR + ...
TAB + "- an archive file"
IF Position(ResAttribute, "C") THEN FileAtt = FileAtt + CR + ...
TAB + "- a compressed file"
IF Position(ResAttribute, "D") THEN FileAtt = FileAtt + CR + ...
TAB + "- a directory"
IF Position(ResAttribute, "H") THEN FileAtt = FileAtt + CR + ...
TAB + "- a hidden file"
IF Position(ResAttribute, "R") THEN FileAtt = FileAtt + CR + ...
TAB + "- a read-only file"
IF Position(ResAttribute, "S") THEN FileAtt = FileAtt + CR + ...
TAB + "- a system file"
// Display the attributes of the file
Info(FileAtt)
ELSE
// Display the error message
Error(ErrorInfo(errMessage))
END
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadIOS WidgetMac CatalystUser code (UMC)Ajax
Example 2: Modifying the attributes of a file
The following code is used to modify the attributes of a file. If this file is not "read-only" (letter R), the file automatically becomes read-only ("read-only" attribute, letter R).
// Declare the variables
ResAttribute is string
ResAttributeModif is string
FilePath is string
// Attributes of the selected file?
ResAttribute = fAttribute(FilePath)
IF ResAttribute <> "ERR" THEN
// The selected file is already read-only?
IF Position(ResAttribute, "R") <> 0 THEN
Info("The file is already read-only")
ELSE
ResAttribute = ResAttribute + "R"
// Modify the attributes of the file
ResAttributeModif = fAttribute(FilePath, ResAttribute)
IF ResAttributeModif <> "ERR" THEN
Info("The file is currently read-only")
END
END
END
IF ResAttribute = "ERR" OR ResAttributeModif = "ERR" THEN
// Display the error message
Error(ErrorInfo(errMessage))
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 08/24/2022

Send a report | Local help