Keep Local Directory Up to Date

Advertisement

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,517
Location:
Prague, Czechia

Re: Keep Local Directory Up to Date

HummS wrote:

I want "keep local directory up to date", and I don't understand how to run this. The manual doesn't explain how to run this official extension.
In WinSCP, go to Commands > Static Custom Commands > Keep Local Directory up to Date.

I tried to use the manual commands in the shell but it says it couldn't find the commands.
How to run the script on command-line is shown in the page itself:
powershell.exe -File KeepLocalUpToDate.ps1 -sessionUrl "sftp://username:password@example.com/" -remotePath "/remote/path" -localPath "C:\local\path"

Reply with quote

ntoreax
Joined:
Posts:
15

keep local directory up to date

Replying on the topic to get a clear picture
when we do the below script
powershell.exe -File KeepLocalUpToDate.ps1 -sessionUrl "sftp://username:password@example.com/" -remotePath "/remote/path" -localPath "C:\local\path"
is it possible to specify the type of file we want to system to download (example log files starting by MTN_xxx) let's say. If yes, how do we specify it?

Axel N

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,517
Location:
Prague, Czechia

Re: keep local directory up to date

@ntoreax: The script does not allow that, as it is. But it's easy to modify it:
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.FileMask = "MTN_*"
 
$differences =
    $session.CompareDirectories(
        [WinSCP.SynchronizationMode]::Local, $localPath, $remotePath, $delete,
        $False, [WinSCP.SynchronizationCriteria]::Time, $transferOptions)
(not tested)

Reply with quote

renansonda
Guest

Re: Keep Local Directory Up to Date

Hi friend,
I need to keep the local directory uptodate and delete the files after transfer to local directory. Is it possible? Can u help me to make the script?
I need to delete the files of the remote directory not the local, ok?

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum