Topic: DMD0388 FILEQUERY - Query File or Folder Information |
|
The Query File or Folder Information (FILEQUERY) instruction is used to retrieve status information about the files and folders on a file system - see example #1 below. This instruction can also be used to generate a list of the folders and files on a file system - see example #2 below.
File System selects which of the available file systems to use:
Query File / Folder Name - the full path (including any directories) of the file on the specified file system. This can be text enclosed in double quotes, or any system or user-defined string. The File Name allows a maximum length of 255 characters including spaces and non-alphanumeric characters, excluding the following characters which have special meaning to the file system * ? " : < > | .
File Date as 1970 Epoch - the date the file was last written to. The value is a 1970 Epoch The number of seconds that have elapsed since 12:00:00PM, January 1, 1970. An epoch is an instant in time chosen as the origin of a particular era. The "epoch" then serves as a reference point from which time is measured. Time measurement units are counted from the epoch so that the date and time of events can be specified unambiguously. number which is the number of seconds of time that have elapsed since midnight at Jan 1 1970. This can be any writable numeric location.
File Size in Bytes - the total number of bytes the file consumes on the file system. This can be any writable numeric location.
File Attributes - a DWord where the individual Bits indicate attributes of the file as described below. This can be any writable numeric location.
Actual File Name - the fully qualified file name as stored on the file system. This can be any of the system-defined Short Strings, system-defined Long Strings, or user-defined String.
The following parameters are only used to iterate the folders and files in the folder specified in Query Folder / File Name parameter. This does not iterate through any sub-folders that exist, it only iterates the contents of the currently selected folder. The iteration process requires using the <File System>.StartFolderScan, <File System>.StopFolderScan, and <File System>.FolderEntryNum structure members. Refer to Example #2 below for their proper usage.
Iterate Folder - enable this option to generate a list of sub-folders and files within the specified folder..
Found File / Folder - after each step in the iteration, this String will contain the name of the folder or file that was found.
Iteration Index - if enabled, the value in <File System>.FolderEntryNum - which contains the number of folders and / or files that were found - is copied here after the iteration is complete,
The On Success and On Error parameters specify what action to perform when this instruction completes. You do not have to use the same type of selection for both On Success and On Error.
If the Set Bit selection is used for either On Success or On Error, the specified BIT location will be SET OFF when the instruction is first enabled and will remain OFF until the instruction completes. Once complete, the appropriate Success or Error bit location will be set ON. The specified Bit location is enabled with a SET (Latch) operation (not an OUT operation) meaning that it will remain ON even if this instruction's input logic goes OFF.
If the JMP to Stage selection is used for either On Success or On Error the target Stage must be in the same Program code-block as this instruction, you cannot specify a target Stage that exists in a different Program code-block. When the operation finishes, the target Stage will be enabled the same way as a standalone Jump to Stage (JMP) instruction would do it. The JMP to Stage option will only be selectable if this instruction is placed in a Program code-block.
On Success selects which of the following actions to perform if the operation is successful:
On Error selects which of
the following actions to perform if the operation is unsuccessful:
If either the On Success or On Error selections are set to JMP to Stage, Automatically create the SG box for any NEW stage number will be enabled which will automatically create any target stage that does not already exist.
|
|
Error CodesImproper use of any FILE instruction or any file system hardware problem will generate a warning message at runtime. When any of these warnings are generated, the On Error parameter in the instruction will be ON and the System ERR variable will contain one of the following text messages. You will also be alerted to this condition by yellow "Warning" text displayed in the Status Bar of Do-more Designer. Clicking that text will open the System Status to display the full text of the warning message.
|
|
Status Display
The red triangle in the upper left corner of the status display indicates this is a Fully Asynchronous instruction.
The gray triangle at the right end of the input leg indicates the input is edge-triggered, meaning this instruction will execute each time the input logic transitions from OFF to ON.
|
|
See Also
FILEQUERY - Query File or Folder Information
FILESEEK - Seek to Position in File
FILESYSCMD - Perform File System Command
EMAIL - Send Email (with file attachment)
|
|
Related Topics
|
|
Example #1: Query for File Information
|
|
Example #2: Iterate the Contents of a Folder
|
|