Mount ssh shares as drives https://sftptogo.com/blog/how-to-map-sftp-as-a-windows-10-drive/
Filestructure
/bu <– root folder
/bu/database <– databases
/bu/server <– files
## Copy files
$Source = "Z:\bu\"
$Destination = "P:\Backups\Server\pluto01_versio\"
Get-ChildItem $Source -Recurse | ForEach {
$ModifiedDestination = $($_.FullName).Replace("$Source","$Destination")
If ((Test-Path $ModifiedDestination) -eq $False) {
Copy-Item $_.FullName $ModifiedDestination
}
}
## Remove stale files
Get-ChildItem –Path "P:\Backups\Server\pluto01_versio\database" -Recurse | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-30))} | Remove-Item
Get-ChildItem –Path "P:\Backups\Server\pluto01_versio\server" -Recurse | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-30))} | Remove-Item