Post a reply

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

mhystique

I'll try, but don't use to much energi on a solution, cause I think I solved it yesterday.

But yes it seems a bit contradictory, but take a look at the folders on the FTP, in particularly these two:
"/P3D/TS2017i/clickonce applications/DS Checker/",
"/P3D/TS2017i/clickonce applications/DS Checker/sync files/"

They should be synchronized from here:
"\\server\dfs\Produktion\0 - RIMTO\VBProj\DS Checker\Poka installation",
"\\server\dfs\Produktion\0 - RIMTO\VBProj\DS Checker\sync files"

And to keep things clean, we want it to delete on the FTP folder, that's not on the source server. Problem is that when it runs the first line, it delete the "sync foles" on the FTP. Next it wants to upload/sync to that folder, but now it isn't there anymore.
Hence the problem, we want it to delete everything want not present in the source, except for the "sync files", and again in that folder should delete things that aren't present.

But I tried this: $TransferOptions.FileMask = "|*/sync files/"
and it seems to do the trick.
martin

Re: How to handle uploads from 2 locale paths to one parent remote folder

mhystique wrote:

and when it handles the first upload it will delete everything that doesn't correspond to the locale folder.
On the other hand, it should also delete files or folders on FTP, that aren't in the locale path any longer.

These two requirements seem to me as the same thing. Can you explain the difference?
mhystique

How to handle uploads from 2 locale paths to one parent remote folder

Hi
I've been working on an PowerShell script, which should upload multiple local folders to a FTP server. But I can't get it to work, as I want.
I'm using SynchronizeDirectories, but perhaps I should use something else, but what?
The problem is, that I need to upload 2 locale paths to one same folder parent folder on the FTP, and when it handles the first upload it will delete everything that doesn't correspond to the locale folder.
On the other hand, it should also delete files or folders on FTP, that aren't in the locale path any longer.
How do I handle that?

My paths are in a array like:
$localePathArray = @(

        "\\server\Tekla\Tekla\TS2017i",
        "\\server\dfs\Produktion\0 - RIMTO\VBProj\DS Checker\Poka installation",
        "\\server\dfs\Produktion\0 - RIMTO\VBProj\DS PDF Merger\Poka installation",
        "\\server\Install\Tekla\DS installation",
        "\\server\dfs\Produktion\0 - RIMTO\VBProj\DS Checker\sync files"
    )

# Put FTP share into array
$remotePathArray = @(
        "/P3D/TS2017i/system/",
        "/P3D/TS2017i/clickonce applications/DS Checker/",
        "/P3D/TS2017i/clickonce applications/DS PDF Merger/",
        "/P3D/TS2017i/installation/",
        "/P3D/TS2017i/clickonce applications/DS Checker/sync files/"
    )

and the synchronization is like
$TransferOptions.FileMask = "null"

# Synchronize files
    for ($i=0; $i -lt $localePathArray.length; $i++) {
       # Write-Host "$localePathArray[$i] $remotePathArray[$i]"
   
        $synchronizationResult = $session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Remote, $localePathArray[$i], $remotePathArray[$i], $True, $False, [WinSCP.SynchronizationCriteria]::Time, $TransferOptions)
    }