I'm writing a script for work - it is supposed to loop through a multi-lined csv file, and separate each row into its own separate csv. The issue I'm having is with this line:
$csvfile = Get-ChildItem -Path $baseDir* -Include *.csv
Here's a snippet of the section where this line is:
# get script directory and add it to a variable
$baseDir = $PSScriptRoot
# Write-Host $baseDir
# get a list of csv file names
$csvfile = Get-ChildItem -Path $baseDir* -Include *.csv
The problem is, the variable $csvfile remains empty, so nothing really happens in my script. When I change '$basedir' in the line with the actual path, it works. Through debugging, I know $basedir has a value in it (and it's correct - the actual path), so I'm not sure why the Get-ChildItem will work with the path, but not the variable.
Hope this explanation makes sense - I am the furthest thing from a programmer.