Hi Nicopulse,
You can try to sync the backup folder to FTP server, to upload the modified files based on lastwritetime to ftp server, please refer to this script:
$BackUpdateTime = (Get-Date).Year.ToString()
$BackUpdateTime += (Get-Date).Month.ToString()
$BackUpdateTime += (Get-Date).Day.ToString()
$BackUpdateTime += (Get-Date).Hour.ToString()
$BackUpdateTime += (Get-Date).Minute.ToString()
$BackUpdateTime += (Get-Date).Second.ToString()
$today = (Get-Date -Format yyyy-MM-dd)
$ftp = "ftp://ftp.mysite.ca/"
$user = "ftpuser"
$pass = "ftppassword"
$webclient = New-Object System.Net.WebClient
$webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass)
#we specify the directory where all files that we want to upload
$Dir="Y:\LocalDirectory\"
$LogFile="I:\PowerShell\MyBackup_"+$today+".txt"
Clear-Host
#Write-Host $LogFile
"From:"+$Dir+" (on server01) To:"+$ftp | Out-File $LogFile -Append
"Start: "+(Get-Date) | Out-File $LogFile -Append
$files = @(Get-ChildItem -Path $Dir -Recurse | ?{ !$_.PSIsContainer } |Where-Object { $_.lastwritetime -gt (get-date).AddDays(-1)} | Select-Object -ExpandProperty FullName )
foreach($item in $files)
{
if($item -ne $null)
{
$uri = New-Object System.Uri($ftp+$item.Substring(3))
$webclient.UploadFile($uri, $item)
#Write-Host (Get-Date)$item
"$(Get-Date): "+$item | Out-File $LogFile -Append
}
}
$webclient.Dispose()
"End:"+(Get-Date) | Out-File $LogFile -Append
Refer to:
PowerShell Backup from Local folder to FTP location
In addition, to manage folders in FTP server, please also check this module to help us to download and upload:
PowerShell FTP Client Module
If there is anything else regarding this issue, please feel free to post back.
Best Regards,
Anna Wang