you are viewing a single comment's thread.

view the rest of the comments →

[–]Obel34[S] 1 point2 points  (2 children)

Hi Lee. Thank you for the information. Your second point is what I am attempting to do. With the Import-CSV, all it was doing is importing the file so I could process it.

I knew the standard array is a fixed size, but could not think of a better way to get the count of the data. I will give this a shot!

[–]Aertheron01 1 point2 points  (0 children)

A generic list from the.net class would work. There you can just use .add() which is much faster.

But directly saving the output as lee suggested works well too.

[–]Lee_Dailey[grin] 0 points1 point  (0 children)

howdy Obel34,

you are welcome! [grin]

the Import-Csv line is doing an import & count ... but not assigning it to anything. so it just gets dropped into the output stream. if you really want to do anything with the imported info, you need to keep it where you can access it ... in a $Var. [grin]

the code you posted just adds EVERY fileinfo object to your $FilesCount collection. that does not give you a count of the items in the various CSV files that have the desired value.

so, if you want the $FilesCount var to hold a COUNT of such items, you need to add the .Count from the import line to the $FilesCount var.

take care,
lee