April 15, 2016 at 5:32 am
Hi all,
I am desperately in need for this solution. Any help is most welcome as I am new to SSIS.
I have files (all types) in one folder and I have to copy them to another folder but each file has to be saved in a separate folder with the file name as the new folder name. Please see below:
i.e –
C:\ source_folder \ FileName_DocId.pdf
This file needs to be copied to the follwing folder structure :
C:\ destination_folder \ FileName_DocId \ FileName.pdf
Basically, every file needs to be saved in its own folder with the naming convention – File Name_Document id
I have tried to search on the internet but no good, hence if someone could tell me ( step by step would be awesome!)
April 15, 2016 at 6:01 am
vikram25 (4/15/2016)
Hi all,I am desperately in need for this solution. Any help is most welcome as I am new to SSIS.
I have files (all types) in one folder and I have to copy them to another folder but each file has to be saved in a separate folder with the file name as the new folder name. Please see below:
i.e –
C:\ source_folder \ FileName_DocId.pdf
This file needs to be copied to the follwing folder structure :
C:\ destination_folder \ FileName_DocId \ FileName.pdf
Basically, every file needs to be saved in its own folder with the naming convention – File Name_Document id
I have tried to search on the internet but no good, hence if someone could tell me ( step by step would be awesome!)
You'll need a script task for this. Here is the logic I would use, with some C# snippets:
1) Create and populate an array of source files
string[] files = Directory.GetFiles(sourceFolder, "*.pdf");
2) foreach (string f in files)
{
Assign new variables to hold f (filename) and f (DocId) and populate them
Test to see whether the proposed target folder exists. If not, create it.
Copy (or move) the file, performing the rename as part of the copy
}
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply