The FileDB Object's Methods
You can see a list of the FileDB object's methods in Table 1. Here's how each method works:
The Include method. The Include method, which Listing 2 shows, uses the FileSystemObject object to obtain a collection of files to be added to the Recordset object. The Include method's syntax is fairly specific. To add all files in a folder, the Path parameter must end with a backslash (\). Without the trailing backslash, the Include method assumes you want to add a specific file. To include files in subfolders of the specified folder, the Recurse parameter must be true.
Callout A in Listing 2 shows how the Include method adds information about a file to the recordset. The method follows these steps:
- It calls the Recordset object's AddNew method. This creates a temporary record that hasn't been saved to the recordset yet.
- It sets each field's value. In this case, the Path field will get the Parent-Folder property's value, the Name field will get the Name property's value, and so forth.
- It uses the Recordset's Update method to save the record to the recordset.
The Exclude method. This method, which uses the Recordset object's Filter property to select the records in the recordset that match the folder or filename specified in the Path parameter (see Web Listing 1). The Exclude method's Path parameter must end in a backslash if you want to remove every file in a particular folder. Otherwise, the Exclude method will assume you want to remove a specific file. Unlike the Include method, the Exclude method doesn't use the FileSystemObject object. This object doesn't let you use wildcards (or something similar) to filter a collection of files by file type or filename. . . .