I need help in writing one PS script to move files at regular intervals from one folder to the another for processing. I have used the below mentioned code but I am not getting on how to check whether the file is already present in the destination or not. It it is present then the file shouldn't be copied. Please help.
$destination = "C:\Users\User\Desktop\Destination\"
$source = "C:\Users\User\Desktop\Source"
$files = Get-ChildItem $source
Write-Host $files
foreach($file in $files)
{
$path = "C:\Users\User\Desktop\Source\" + $file
Move-Item -Path $path -Destination $destination -Force
}
Please help on Checking whether the file is there in Destination folder and skip it from moving.
Regards,
Mitesh Agrawal