Create a batch script that automates the task of keeping the local folder updated

Advertisement

argonauta
Joined:
Posts:
1

Create a batch script that automates the task of keeping the local folder updated

I need help: I ​​don't understand how to create and script the oration of
"keep local folder updated" via FTP protocol.

I'll explain:
I have a program on my PC that schedules the execution of the script I need to create every so many times, which should perform the operation
keep the local folder updated every night at 11.50pm.

the transfer code generated by WinSCP for PowerShell is:
# Carica assembly .NET WinSCP
Add-Type -Path "WinSCPnet.dll"
 
# Imposta le opzioni di sessione
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = [WinSCP.Protocol]::Ftp
    HostName = "mydomine.com"
    UserName = "xxxxxxx"
    Password = "abcdef"
}
 
$sessionOptions.AddRawSettings("ProxyPort", "0")
 
$session = New-Object WinSCP.Session
 
try
{
    # Connetti
    $session.Open($sessionOptions)
 
    # Trasferisci file
    $session.GetFiles("/public_html/index.html", "percorso\Backup_auto\*").Check()
}
finally
{
    $session.Dispose()
}
If I create the PowerShell script in z:\folder1\powershell.txt and the batch file in the same directory, how should I write the batch script?

Thanks for your help

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum