Deleting files using foreach loop and File System Task

  • Hi, I've created a foreach loop container, in the 'Collection' tab I specified the enumerator, the folder from which to delete (the path) , and a fie mask (sms_*.csv) to specify the files that I intend to delete.

    In the Variable Mappings tab I stored the enumerated filename in a pre-created variable. The index is 0 and after that I have wired up the File System task selecting the value "Delete File" in the operation field and I've set up the IsSourcePathVariable to True and selecting my variable in the "SourceVariable" field. The loop is working but just deletes the recent file in the directory, not all files present in that folder like i've specified (sms_*.csv.

    Why is this so? please help.

    Thanks

    .

  • Have you verified that the data in the variable is changing as you expect in the loop? You can use a script component with a MEssageBox to show the value in the variable.

  • Thanks Jack, problem solved! I didn't put the delete task inside the container! 🙂

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply