resolved input-csv random file-names

I’ve been looking and trying to figure out how to use input-csv to grab any csv file within a specified folder.

need to run a script against csv files that will have different file-names every-time.

any ideas?

You can just use Get-ChildItem *.csv to find the files, and then import them inside a loop. Something like this:

Get-ChildItem c:\SomeFolder\*.csv |
ForEach-Object {
    $file = $_
    $data = Import-Csv -Path $file.FullName
    # Do something with the data in $file

was hoping for a little easier method, as it will only ever be 1 file in the input file location, i will then move the file out after processing.

get-childitem seemed a little more complex than needed

never mind i should have just tried it. didn’t think it actually would be as easy as *.csv

somedays you over-think things