sqlagent007
asked on
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!
Is there a way to do this with SSIS?
Thanks experts!
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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.
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.
ASKER
Thanks!
Check the files in the folder using System.IO
If file exists in that folder move that using the method "File.Move(stcFileName, destFileName)"