Hi, I have a problem with Get-ChildItem, maybe I am using the wrong syntax or I am misinterpreting how it works.
Tha case is simple, I have 2 folders on the Desktop, “Vendite” and “New folder”, both folders contain the same CSV files. I need to import the last edited file on the folder “Vendite” but when I try to select it it selects also the one in the other folder.
This is one of the files (I will have a new file each day, so that is why I’m filtering): SDD_380712_020_021_IBACDC_250529_00332.csv_20250529-043101.sav
$VenditeGrezze = "C:\Users\AdminATLAS\Desktop\Vendite" #the path with my files
$fileCDC = Get-ChildItem -Path $VendteGrezze -Include "*IBACDC*" "*.csv*" -Recurse
Sort-Object LastWriteTime |
Select-Object -Last 1
Write-Output $fileCDC
$Data = Import-Csv -Path $FileCDC -Delimiter '|' -ErrorAction Stop
Thank you in advance