Solved

Combine 400 file

Posted on 2013-01-15
3
380 Views
Last Modified: 2013-01-15
Hello

I wanted to know the quickest way to to do this?

Combine 400 csv files to one csv file?

How to do quickest - for DB upload...

thnkas
0
Comment
Question by:Rayne
3 Comments
 
LVL 31

Assisted Solution

by:James Murrell
James Murrell earned 75 total points
ID: 38780637
0
 
LVL 69

Accepted Solution

by:
Qlemo earned 425 total points
ID: 38780663
DOS method - has superfluous header info for each file, so would need to delete that after importing into DB:
@echo off
for %%F in (C:\Folder\*.csv) do copy /b c:\temp\result.csv+%%F

Open in new window

PowerShell method - header info is written once:
get-childitem C:\Folder\*.csv | foreach-object { import-csv $_.FullName ] | export-csv c:\temp\result.csv -NoTypeInfo

Open in new window

Using VBScript with FileSystemObject is another approach, and there are many more.

But probably importing csv files one by one might be better performance-wise. Having to write a big file out of 400 smaller needs a lot of additional I/O.
0
 

Author Closing Comment

by:Rayne
ID: 38781231
Thank you Guys for the Help :)
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question