Chapter 8. Manipulating Files with the File System Task

When you need to move, delete, or rename a file, or make just about any other changes to it, the File System Task is the task to use. The File System Task allows you to make changes to files or directories and move them around without having to write custom scripts. The File System Task is a commonly used and powerful task in SSIS. A File System Task can:

  • Copy a directory

  • Copy a file

  • Create a directory

  • Delete a directory

  • Delete the contents of a directory

  • Delete a file

  • Move a directory

  • Move a file

  • Rename a file

  • Change the attributes of a file

You can bring up the File System Task Editor by double-clicking the File System Task or by right-clicking and selecting Edit. In the editor you see several fields to set to perform the needed operation. The Operation property is the action the task is going to perform when executing. In Figure 8-1 you can see the drop-down menu for the Operation property. What you select in this menu determines which properties will be available to you. For example, when you select Delete File, you do not need a destination, just a source file to delete, so a destination will not be available.

Figure 8-1

Figure 8-1. Figure 8-1

The property IsSourcePathVariable allows you to use a variable for the source. This variable will be a string variable that holds the location of the file, for example, C:\SSIS\FlatFile.csv. Instead of placing ...

Get Knight's 24-Hour Trainer: Microsoft® SQL Server® 2008 Integration Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.