FILEFIND.GET Function
Syntax
Arguments
- patternCharacter
A pattern to select file names using wildcard characters like ?*' and ?? '.
- file_attributeNumeric
Default = 0 (normal files). The File_Attribute parameter is a numeric value specifying the type of file to find. You can find files that have one or more of the following attributes:
- File Attribute
- Description
- FILE_FIND_NORMAL
Normal
- FILE_FIND_READONLY
Read-only
- FILE_FIND_HIDDEN
Hidden
- FILE_FIND_SYSTEM
System
- FILE_FIND_LABEL
Label
- FILE_FIND_DIRECTORY
Directory
- FILE_FIND_ARCHIVE
Archive
- FILE_FIND_AND_FLAGS
Specifies that multiple flags should be ANDed together rather than ORed. By default flags are ORed.
- FILE_FIND_NOT_READONLY
Files that are NOT readonly
- FILE_FIND_NOT_DIRECTORY
Files that are NOT directory files
- FILE_FIND_NOT_ARCHIVE
Files that do not have their archive bit turned on.
- FILE_FIND_AND_NOT_FLAGS
Specifies that when multiple "NOT" flags are used that the flags should be ANDed together.
- filefindformatCharacter
Specifies the type of file to retrieve. The format string can contain these characters:
- Format Character
- Description
- P
Path
- N
Filename
- D
Directory - "d" if file is a directory, "-" if not.
- H
Hidden - "h" if file is hidden, "-" if not.
- S
System - "s" if file is a system file, "-" if not.
- T
Date and time file was last updated
- L
Size
- C
Creation date and time
- R
Last time read
- A
Archive bit
- X
DOS short name (8.3), if the file is a long file name
Returns
- listCharacter
Returns a CR-LF delimited list of files and details about files in a directory that match the specified pattern.
Description
Returns a string containing all the files - you can specify what gets listed.
Discussion
The FILEFIND.GET() method creates a CR-LF delimited string with information about the files in a directory that match a pattern. The format string controls the format in which the information is returned.
Example
The following script populates an array with information about the files in a folder. The '0' attribute is used to select normal files. The format string returns the full name, the directory flag, and the date time stamp. The information is displayed in a dialog box.
list = FILEFIND.get("C:\Program Files (x86)\Alpha Anywhere\*.*",0,"PN|D|T") format = "name|directory|time" dim pp[0] as P pp.initialize_properties(format,list) dim indx as N indx = 1 ui_dlg_box("Display File Information",<<%a% Name|Directory|Time; [.30,20indx^#pp[\].name]|[.10,20indx^#pp[\].directory]|[.40,20indx^#pp[\].time]; %a%)
How To Identify an Empty Directory
The following script determines if a directory is empty.
dim path as C dim files as C path = "YOUR DIRECTORY" files = FILEFIND.get(path + "\*.*", FILE_FIND_NOT_DIRECTORY, "N") if (files = "") then 'The directory is empty end if
See Also