I'm new in Powershell and I want to download all the files whose date is more recent than the local files (folders and sub-folders of the FTP path).
Here is my current script :
$FTPServer = "ftp://xx.xx.xx.xx/xxxx/xxxx/xxxx"
$FTPSessionName = "GERA_FTPSession"
$localPath= "E:\xxxx\"
$username = "***"
$password = "*******"
# Import a module of FTP code
# https://gallery.technet.microsoft.com/scriptcenter/PowerShell-FTP-Client-db6fe0cb
Import-Module PSFTP
$secstr = New-Object -TypeName System.Security.SecureString
$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
# connnection FTP
Set-FTPConnection -Credentials $Cred -Server $FTPServer -Session GERA_FTP -UsePassive
$FTPSessionName = Get-FTPConnection -Session GERA_FTP
#import files and folders
Get-FTPChildItem -Session $FTPSessionName -Recurse | Get-FTPItem -Session $FTPSessionName -localpath $localPath -RecreateFolders -Overwrite -Verbose
Thanks for your help
Arnaud