×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Load Multiple Files from Source to Respective Multiple Folders (SSIS)

Load Multiple Files from Source to Respective Multiple Folders (SSIS)

Load Multiple Files from Source to Respective Multiple Folders (SSIS)

(OP)
Hi All,

In SSIS or SQL-stored procedure, I need to load multiple files to multiple folders with respect to file names
I have a scenario
Source folder = “Data Source Folder”

Files in source folders
Customer_datafile_data.csv
Customer_Branch_data.csv
Customer_City_data.csv
Employee_datafile_Dec2020.csv
Employee_Info_Dec2020.csv
Products_Information.csv

Destination Folders =
Customer
Employee
Products

Files destination as
“Customer_datafile.csv” LOADS IN “ Customer”
"Customer_Branch_data.csv" LOADS IN “ Customer”
"Customer_City_data.csv” LOADS IN “ Customer”

“Employee_datafile_Dec2020.csv” LOADS IN “Employee”
Employee_Info_Dec2020.csv ” LOADS IN “Employee”

“Products_Information.csv” LOADS IN “Products”

No. of files for one destination could be as many. No. of folders may be as many (not 3 it could be 4 or 5 )
One thing that I can control is the prefix of file is matched with folder name in which it has to load
Please help me in some good solution. Thanks









RE: Load Multiple Files from Source to Respective Multiple Folders (SSIS)

not sure if you are giving all info required for us to point you in the right direction.

regardless of that if this is just a move files from one folder to another do not use SSIS at all, and rather use powershell.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
www.syssoft-int.com

FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

RE: Load Multiple Files from Source to Respective Multiple Folders (SSIS)

(OP)
Thanks Frederico for the response.
I think I have provided all the information required in terms of folders and file structure.
My requirement is to move multiple files from the mentioned source folder to multiple target folder based on their names. e.g files starting with 'Customer' should to to Customer folder and so on.

As you have mentioned, not necessarily SSIS/foreach loop container etc., I could try powershell as well but I am not expert. If I could get help I will try out. Thanks.
If you have any question please let me know. Thanks

RE: Load Multiple Files from Source to Respective Multiple Folders (SSIS)

this is the type of question that a google search gives back lots of results - no need to be an expert.

create a file (config.csv) with following content - adapt folder as required
Pattern,DestinationFolder
customer_,c:\temp2\Customer
employee_,c:\temp2\employee
products_,c:\temp2\products

then create a powershell script like this - how you execute it you can google or read the manual

$inputfolder = "c:\temp2\input"
$config = Import-Csv C:\temp2\config.csv
foreach ($entry in $config)
{
Get-ChildItem -Path $inputfolder| where {$_.name -like "$($entry.Pattern)*.csv"}|Move-Item -Destination $entry.DestinationFolder -Force
}

Regards

Frederico Fonseca
SysSoft Integrated Ltd
www.syssoft-int.com

FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

RE: Load Multiple Files from Source to Respective Multiple Folders (SSIS)

(OP)
Thanks you Frederico. I tried it according to my folders and it worked like a charm.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close