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

Kilsgaard

Re: Powershell - SynchronizeDirectories - The argument is null or empty

Hi

Thanks for your answer :-)

I have solved the problem, it was one of the winscp variables that I accedentialy set to an empty value :-(
martin

Re: Powershell - SynchronizeDirectories - The argument is null or empty

Kilsgaard wrote:

I get the following error when i syncronize to or from my ftp with a powershell script, build on the template.
"The argument is null or empty. Provide an argument that is not null or empty, and then try the command again."

Where do you get the error? On what command? Is this really a full error message? Doesn't it name the argument?
I cannot reproduce the problem with your code.

but should: $synchronizationResult.IsSuccess be $false if there is no files that have been syncronized?

Where there are no files to synchronize, the IsSuccess is $True.
Kilsgaard

Powershell - SynchronizeDirectories - The argument is null or empty

Hi

Can anyone give me an idea how to solve this?

I get the following error when i syncronize to or from my ftp with a powershell script, build on the template.
"The argument is null or empty. Provide an argument that is not null or empty, and then try the command again."

It looks like it is when there is no files to syncronize, but should: $synchronizationResult.IsSuccess be $false if there is no files that have been syncronized?
I am using the $synchronizationResult to move or removed syncronized files.

Can anyone tell me if there is any other trick to test if the $synchronizationResult is empty?

   

try
{
    $session.Open($sessionOptions)

    $transferOptions = New-Object WinSCP.TransferOptions
    $transferOptions.FileMask       =  "|*/"
    $transferOptions.OverwriteMode  =  [WinSCP.OverwriteMode]::Overwrite
    $transferOptions.TransferMode   =  [WinSCP.TransferMode]::Binary

    $synchronizationResult = $session.SynchronizeDirectories(
    [WinSCP.SynchronizationMode]::Local, $localPath, $remotePath, $False, $False, [WinSCP.SynchronizationCriteria]::None, $transferOptions)

    if ($synchronizationResult.IsSuccess -eq $true)
    {
       foreach ($download in $synchronizationResult.Downloads)
       {


Thanks on advance
/Graves