AggregateFiles Parameter (Connect-CSV Cmdlet)
When set to true, the provider will aggregate all the files located in the URI directory that have the same schema into a single table called AggregatedFiles .
Syntax
Connect-CSV -AggregateFiles SwitchParameter
Data Type
bool
Default Value
false
Remarks
By default, the first file in the folder is used to define the schema, however MetadataDiscoveryURI can be specified to use a different file instead.
Take for example the following CSV contents.
File 1
ItemID,Name,NumInStock 1,Peanuts - Salted,76 2,Peanuts - Unsalted,43 3,Raisins,26
File 2
ItemID,Name,NumInStock 4,Pretzels - Original,55 5,Pretzels - Chocolate,35 6,Toffee,44
The resulting aggregate table is shown below. Note that only the columns present in the defined schema are used in the aggregate.
AggregateFiles
ItemID,Name,NumInStock 1,Peanuts - Salted,76 2,Peanuts - Unsalted,43 3,Raisins,26 4,Pretzels - Original,55 5,Pretzels - Chocolate,35 6,Toffee,44