Powershell - SynchronizeDirectories - The argument is null or empty

Advertisement

Kilsgaard
Joined:
Posts:
4
Location:
Silkeborg, Denmark

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,670
Location:
Prague, Czechia

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.

Reply with quote

Kilsgaard
Joined:
Posts:
4
Location:
Silkeborg, Denmark

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 :-(

Reply with quote

Advertisement

You can post new topics in this forum