I am trying to copy some file from source directory to target directory by a script. The condition is the new file supposed to come everyday at some certain time. My scripts is checking the pattern of the file name and check the dates if greater than today's date (00:00:00) then copying it. But its working fine if latest date's file is available on next morning then copy that file. But if the latest file is not available then it copying all the other files from that source directory. Can anyone check my script and tell me what's wrong in it?
$fromDir = "\\fil\folder\path\files"
$destinationMask = Join-Path "C:\XXX\ABCD_K_Integration\F_datafiles" "{0}.kis.txt"
$files = Get-ChildItem $fromDir `
| where Name -match "ALMR12_\d+.txt" `
| where { ! $_.PSIsContainer } `
| where LastWriteTime -gt (get-date -Hour 0 -Minute 0 -Second 0)
# copy file
Get-ChildItem $fromDir -filter "$files" | where { ! $_.PSIsContainer } | Copy-Item -Dest {"$destinationMask" -f $_.BaseName}
This is my source file list.
You can see last file came on 30th, which means if i run my job it is copying all the files, but if i create a 0 byte file with todays date for testing then my script is working properly. Can't understand what's wrong in the script.

Tested following and it works fine for me. Nothing is copied if no file fullfils the filter