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

martin

The file has no name, what confuses the WinSCP parser.

You will have troubles excluding it by its full name due to the perceived presence of slashes in the name.

But you can try to use exclude mask like | *modify=20131010193915*
majestic

I agree that it looks strange. When I connect using the WinSCP GUI I can see the strange folder in question (image001), but when I connect using FileZilla, the directory name appears to be blank or null (image002). Either way, I would like to know how to just ignore that strange folder altogether if that's possible.

Log zipped and attached.

Thank you for the assistance.
martin

Re: Synchronization exluding folder

There's something strange going on. That's does not look like a directory name, that looks like a directory listing line in MLSx format.

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.
majestic

Synchronization exluding folder

I am trying to sync a remote FTP folder to a local folder using Powershell. The remote FTP folder has a strange directory name that I am trying to exclude using a file mask. I have tried various combinations, but I am always getting the same error:

Error listing directory '/ftp_images/manufacturers/type=dir;sizd=4096;modify=20131010193915;UNIX.mode=0775;UNIX.uid=48;UNIX.gid=48;unique=14g1004d1;'.
Could not retrieve directory listing
Can't change directory to /ftp_images/manufacturers/type=dir;sizd=4096;modify=20131010193915;UNIX.mode=0775;UNIX.uid=48;UNIX.gid=48;unique=14g1004d1;/: No such file or directory

It would appear that WinSCP is trying to list the folder even though I have it excluded in my script and that is throwing the error. Does anyone know how to prevent WinSCP from even trying to list the folder or change to the directory?

Here's my code:
try

{
# Load WinSCP .NET assembly
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"

# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Ftp
$sessionOptions.HostName = "HOST"
$sessionOptions.UserName = "USENAME"
$sessionOptions.Password = "PASSWORD"

$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.FileMask = "| ftp_images/manufacturers/type=dir;;sizd=4096;;modify=20131010193915;;UNIX.mode=0775;;UNIX.uid=48;;UNIX.gid=48;;unique=14g1004d1;;/"

$session = New-Object WinSCP.Session
$session.SessionLogPath = "D:\winscp.log"
 
      try
      {
      # Progress
      $session.add_FileTransferred( { FileTransferred($_) } )
      
      # Connect
      $session.Open($sessionOptions)
      
      #Sync
      $synchronizationResult = $session.SynchronizeDirectories(
            [WinSCP.SynchronizationMode]::Local, $destfilepath, $sourcefilepath, $False, $transferOptions)

      # Throw on any error
        $synchronizationResult.Check()
      
        # Print results
         foreach ($sync in $synchronizationResult.Transfers)
         {
            Write-Host ("Upload of {0} succeeded" -f $sync.FileName)
            Write-Host "============================================"
         }
      }
      finally
      {
        # Disconnect, clean up
        $session.Dispose()
      }
}
catch [Exception]
{
Write-Host $_.Exception.Message
exit 1
}


Any help would be appreciated. Thank you.