Powershell dosyası şöyle:
$source = "C:\Temp\"
$dest = "C:\Temp\Dest\"
$kopyalanacakDosyalar = "*.xml"
Write-Host "Kaynak Dizin => " $source
Write-Host "Hedef Dizin => " $dest
Write-Host "Kopyalanacak Dosyalar => " $kopyalanacakDosyalar
$TestPath = Test-Path $dest
IF (!$TestPath) {
Write-Host "Hedef dizin mevcut degil"
Copy-Item $source $dest -Verbose
PC1 - no file found. Copying
} ELSE {
Write-Host "Hedef mevcut dosyalar taranarak hedefte olmayan kopyalanacak"
$files = (Get-ChildItem $source -recurse -filter $kopyalanacakDosyalar | where-object {-not ($_.PSIsContainer) -AND $_.lastwritetime -gt (get-date).addminutes(-10)});
$files|foreach($_){
if (!([system.io.file]::Exists($dest+$_.name))){
cp $_.Fullname ($dest+$_.name)
};
}
}