folder with many csv files... want to combine

jamesmetcalf74
jamesmetcalf74 used Ask the Experts™
on
can someone tell me how to combine a folder with about 100 csv files
powershell would be great...
id like the script to not care what the name of the files is
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
yo_beeDirector of Information Technology

Commented:
Do you want to read each file into a single csv file?
Do all the csv files have the same columns?

Author

Commented:
yes
one big csv file
yes they do have the same columns
Director of Information Technology
Commented:
Here you are using three separate cmdlets to get the desired results.
Get-ChildItem  or GCI
Get-Content or GC
Select w skip the first row
 Add-Content or AC

##This will loop through the folder of choice and for each CSV 
GCI -Path G:\documents\TestFolder -Filter *.csv | %{Gc -Path $_.fullname | Select -Skip 1 | ac Test.csv}

}

Open in new window

Author

Commented:
could you write the cmd for me

the files are going to be    
in c:\files
yo_beeDirector of Information Technology

Commented:
all you need to do is replace G:\Documents\TestFolder with c:\files.  
Where do you want the output to go?

GCI -Path c:\files -Filter *.csv | %{Gc -Path $_.fullname | Select -Skip 1 | ac Test.csv}

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial