Getting get output error while running below script
# Set the path to the directory containing the Excel files
$directoryPath = "\\njioilmssqlq01\VendorExport\CovertSheetWindSchExport"
# Get the current date
$currentDate = Get-Date -Format "ddMMyyyy"
# Construct the file pattern for today's Excel files
$filePattern = "*_$currentDate.xlsx"
# Get the Excel files matching the file pattern in the specified directory
$excelFiles = Get-ChildItem -Path $directoryPath -Filter $filePattern -File
# Get the count of Excel files
$fileCount = $excelFiles.Count
# Output the date and file count
Write-Host "Today's date: $currentDate"
Write-Host "Excel file count: $fileCount"
# Output the path and file names of the Excel files
if ($fileCount -gt 0) {
Write-Host "Excel files found today:"
foreach ($file in $excelFiles) {
Write-Host "Path: $($file.DirectoryName)"
Write-Host "File Name: $($file.Name)"
}
} else {
Write-Host "No Excel files found today."
}
