After creating the subfolder, the MoveFiles function moves each file in the collection of filtered files to the target folder. The FileSystemObject object's MoveFile method can move multiple files by using wildcards. For example, the following code moves all .jpg files from one location to another:
fso.MoveFile c:\photos\*.jpg,
d:\photos
However, the code doesn't report the successful move of each file. In contrast, the MoveFiles function, which Listing 4 shows, moves all files that have a specified extension and reports the success or failure of each file move. The filteredFilesCollection Dictionary object that's populated in the CreateFolderFunction provides this enhanced reporting capability to the MoveFiles function.
The full FilesUpload.wsf script is more extensive than the snippets I show here. For example, the script contains several error-handling routines and useful functions for padding date values with zeros. Because the script contains more than I can cover here, I've made a point of commenting the full download heavily to give you a better sense of how it works.