Timing & moving files

Hi, I have a problem where some legacy software is meant to find & read a file that will arrive in one directory and then move it to another, in a short time frame (about 10seconds). It doesn’t always find the file but if the file stays in the source location it will cause problems for all the other clients also using this.

I can monitor files being created or deleted with below code, from a tutorial, but I’m falling down trying to work out the logic for moving them after a time delay.

$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = 'C:\Temp\test'
$watcher.EnableRaisingEvents = $true
$destination = 'C:\Temp\testBKP'
$action =
    $path = $event.SourceEventArgs.FullPath
    $name = $event.SourceEventArgs.Name
    $changetype = $event.SourceEventArgs.ChangeType
    Write-Host "File $name at $path was $changetype at $(get-date)"

Register-ObjectEvent $watcher 'Created' -Action $action  
Register-ObjectEvent $watcher 'Deleted' -Action $action

I can test if a file exists easy enough and I tried to combine it with sleep within the $action code block, this worked, but it delays registering new files being created. Do I need to do something with file creation time and checking the time elapsed?

sleep -s 10
if (Test-Path $path)
    Move-Item -Path $path -Destination $destination
    Write-host "File $name moved to:"$destination