Code:
$Path = "C:\Users\xxxx\Downloads\New";
$filename="$Path\c.txt";
#create file if it does not exist
if(-not (Test-Path $filename))
{
New-Item -ItemType file -Path $filename
}
#write current date to file
$currentDate = get-date
Add-Content $filename -Value $currentDate
#get files in the folder and assign items to a collection
$files = Get-ChildItem -Path $Path
#iterate item
foreach($item in $files){
Write-Host $item
}
Result: