Subscribe to Windows IT Pro
May 08, 2006 12:00 AM

Creating an Automated Upload Solution for Moving Files

Windows IT Pro
InstantDoc ID #49995
Rating: (0)
Downloads
49995.zip

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.

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.