Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

export-csv & reading multiple csv files

$
0
0

Hi,

I have a folder full of csv files. I'd like to be able to read in only the info that was written in the last few days for all files and write a csv out including the filename of the csv file.

I've got the importing done for one file, but I'm having trouble working out the export-csv.

Is there a way I can read in all files in this folder?

My csv header rows are: "Activity,Date,Time,User,IP"

My import script looks like this:

Clear-Host
$FilePath = "\\pc\share\computer\csmpc32.csv" 
$import = Import-CSV $FilePath | Where-Object {$_.Date -eq "13/06/2013" -or $_.Date -eq "12/06/2013" -or $_.Date -eq "11/06/2013" -or $_.Date -eq "10/06/2013"} 

Can anyone offer assistance with the export-csv?

I'm using this:

Export-Csv -Path "c:\test.csv" -InputObject $import 

But i get useless info in the csv file

Cheers


Viewing all articles
Browse latest Browse all 15370

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>