How to Delete Only Files from SFTP in SSIS (Without Deleting Folder) – ZappySys SSIS PowerPack

:pushpin: Overview

When using SFTP/FTP Task in SSIS PowerPack, you may want to download files and delete them from the source after processing.

ZappySys provides an option:

Download FTP Server file(s) to local directory → Delete source file(s) after successful transfer (delete empty folders)

However, this option also removes empty folders, which may not be suitable when you need to preserve the folder structure.


:red_exclamation_mark: Problem

Requirement:

  • :white_check_mark: Download files from SFTP
  • :white_check_mark: Delete files after download
  • :cross_mark: Keep the folder (even if empty)

Actual Behavior:
When using:

Delete source file(s) after successful transfer (delete empty folders)

:right_arrow: The task deletes:

  • Files :white_check_mark:
  • Empty folders :cross_mark: (unexpected in this use case)

:warning: Limitation

Currently, there is no built-in option to:

Delete only files while preserving folders


:white_check_mark: Solution (Workaround)

To achieve the desired behavior, avoid using the built-in “Delete after download” option and instead use a two-step approach.


:wrench: Step-by-Step Implementation

:play_button: Step 1: Download Files (Without Delete Option)

Use SFTP Task:

Configuration:

  • Operation: Download File(s)
  • Recursive: :white_check_mark: Enabled (if needed)
  • :cross_mark: Uncheck: Delete source file(s) after successful transfer


:play_button: Step 2: Delete Files Separately

Add another SFTP Task to delete files explicitly.

Configuration:

  • Operation: Delete File(s)
  • Recursive: :white_check_mark: Enabled
  • Target only files in the folder


:brick: Package Design

Use two separate tasks in Control Flow:


:warning: Important Notes

  • Do not use the built-in delete option if you want to preserve folders
  • The separate delete step ensures only files are removed
  • Folder structure will remain intact even if empty
  • Always test with sample data before production

:bar_chart: Summary

Feature Behavior
Built-in delete after download Deletes files + empty folders
Separate delete task Deletes files only
Folder preservation :white_check_mark: Supported via workaround

:chequered_flag: Conclusion

The built-in option:

Delete source file(s) after successful transfer

It is not suitable when folder preservation is required.

Instead, using a separate delete step provides full control and ensures:

  • Only files are deleted
  • Folder structure remains untouched

Need Help?

If you still face issues, share logs/screenshots with the ZappySys support team:
* Live Chat: Open the chat widget (bottom right of this page)
* Email: support@zappysys.com
* Support Center: Support | ZappySys