Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

renansonda

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?
martin

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)
ntoreax

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
martin

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"
HummS

Keep Local Directory Up to Date

Hello,

can someone please explain me how to setup this:
Keep local directory up to date (download changed files from remote SFTP/FTP server)

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.

I tried to use the manual commands in the shell but it says it couldn't find the commands.

Can someone explain it like ELI5?

Thanks.