2

I created an SSIS package that extracts two files from a .zip file, imports data from them and then attempts to delete the files that were extracted.

The package works, data is imported and all tasks report success. However the File System Tasks that attempt to delete the files don't delete them, even though they report success. I use the CozyRoc Zip Task to extract the files. When I remove the Zip Task, the File System Tasks actually do delete the files. I'm not certain that CozyRoc is causing the problem, but the existence of that task may be causing other issues with the package.

  • Can anyone help me figure out how to reliably delete the files?
  • Do I need to put in some sort of pause after the Data Flow Tasks to allow them to release whatever locks they might have on the files?
  • Is there a way to view the DOS commands that the File System tasks use at run time, to verify that they are actually attempting to delete the correct files?

Thank You, Robbie

Control Flow:

Control Flow

Details:

  • Visual Studio 2019 v16.11.3
  • File Names are from Flat File Connection Managers (See image below).
  • Flat File Connection Managers use Expressions to set their connection strings.
  • The same connection managers are used to import the data, so I presume that they accurately refer to the correct files and their correct locations.

File System Task Editor for one of the delete tasks:

File System Task Editor

Hadi
  • 36,233
  • 13
  • 65
  • 124
Robbie
  • 71
  • 4
  • My recommendation for situations like this, where it sounds like you're having problems with file droppings, is to create a temporary folder for each import (e.g.: use a Script task that concatenates `System.IO.Path.GetTempPath()` and `System.IO.Path.GetRandomFileName()` and calls `System.IO.Directory.CreateDirectory(fullRandomPath)` to make the folder), move your file(s) into that temp folder, do your processing there, and then recursively delete that entire temp folder when done. – AlwaysLearning Feb 25 '22 at 23:19
  • Maybe CozyRoc is not releasing files, try the intermediate folder like @AlwaysLearning mentioned and try moving/deleting files. Also, are you trying to extract in the same location as zip file? – Subodh Wasankar Feb 25 '22 at 23:40
  • It's also worth pointing out that your Data Flows always assume "Success." Consider putting both of your Data Flow tasks inside a Sequence Container, attach both its Success and Failure outputs to the first Delete task, and attach both its Success and Failure outputs to the second Delete task. – AlwaysLearning Feb 25 '22 at 23:55

0 Answers0