Tuesday, October 6, 2009

Delete bunch of dynamic files

Question: How to delete all files from a directory?

Answer: Please follow the following steps:

Step1: Add a For each loop container. & Inside it add a File system task.

Step2: Add 2 variables (Scope: Package level)
  1. Var_FilePath
  2. Var_InputFolder

Step3; Double click on Foreach loop container and in expression map the "Directory" property to Var-InputFolder. (Click on the image for larger view)

Please select the "Reterive file name" property to fully qualified.

Step4; Map the Var_FilePath in variable mapping tab.

Step5: Double click on File system task and change the operation to "Delete file" and Set IsSourcePathVariable property to TRUE. Then map your Var_FilePath to it. (Click Image)

Step6: Now select the File System Task and press F4 for property window. Set the "Delay validation" to True.

Step7: Execute your package.

Hope this will help you.


No comments:

Post a Comment