Session.SynchronizeDirectories error

Advertisement

mlogan
Guest

Session.SynchronizeDirectories error

I am using the SynchronizeDirectories in PowerShell, through the .Net assembly to clear a remote directory. Sometimes, the SynchronizeDirectories function will try to delete a folder that is not empty.

I am using SynchronizeDirectories likes this:

$synchronizationResult = $session.SynchronizeDirectories(
                [WinSCP.SynchronizationMode]::Remote, 
                "C:\LocalEmptyFolder", 
                "/Remote/Folder/With/Content, 
                $True,
                $True,
                [WinSCP.SynchronizationCriteria]::Either,
                $transferOptions)

$transferOptions = New-Object WinSCP.TransferOptions
    $transferOptions.PreserveTimestamp = $True

this will sometimes result in this error:

##[error]Exception calling "Check" with "0" argument(s): "Error deleting file
'/Remote/Folder/With/Content/Foler_1'.
The directory is not empty.
Error code: 18
Error message from server (en): The directory is not empty. "

I have noticed this only happens with a folder that has an underscore in the name. The error occurrs when calling $synchronizationResult.Check().

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
32,052
Location:
Prague, Czechia

Re: Session.SynchronizeDirectories error

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

mlogan
Guest

Attaching the session log

We were able to replicate the error. I'm attaching a scrubbed log file.
  • winscp_scrubbed.log (23.31 KB, Private file)

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
32,052
Location:
Prague, Czechia

Re: Attaching the session log

Thanks. What file remained in the folder, where WinSCP fails?

Reply with quote

Advertisement

You can post new topics in this forum