• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 638
  • Last Modified:

use an SSIS package to copy folders and rename them with FOLDER_YYYYMMDD

I have seen several examples online where people are using the SSIS for each loop container to move \ copy files from one destination to another, however I need to copy folders from our primary storage to second tier storage. Currently all the databases backup to a primary storage device that is mapped as the [G:] drive. I need to copy all the folders that contain the database backups with the .bak and .trn files to my secondary (cheaper) storage at a UNC path.
Is there a way to do this with SSIS?
Thanks experts!
1 Solution
Use Script task

Check the files in the folder using System.IO

If file exists in that folder move that using the method "File.Move(stcFileName, destFileName)"
Use a filesystem task.

Please see below what options you have with a filesystem task. One of which is "Move Folder"

Reza RadConsultant, TrainerCommented:
If folders which you want to copy and rename  has specified names you can simply use File System Task (  sometimes combined with Foreach Loop Container )
but if your folder names are not obvious, It is better to use Script task with System.IO classes.

I think this is better to tell us what you want to do exactly, with sample name of folders and we tell you right way.
sqlagent007Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now