Unexpected directory listing line ‘…’

You will get the error with SCP protocol, if output of ls command cannot be parsed by WinSCP. WinSCP expects listing in format:

<type><permissions> <inode> <owner> <group> <size> <timestamp> <filename>[ -> <target>]


Some common examples:

drw-r--r--    3 martinp users        4596 2007-06-06 11:18:33.000000000 +0200 private
lrwxrwxrwx    1 martinp users           4 Mar 24  2005 wiki -> dokuwiki
drwxr-xr-x+   2 martinp users          96 Oct 26 14:58 httpdocs

If your listing does not correspond to some of the above:

  • Try using SFTP protocol instead of SCP.
  • Always make sure you are using the latest version of WinSCP, as support for different listing format is being added continuously.
  • Alter output of ls command to match any of the supported formatting. WinSCP has few session options that may be used for that, including:
    • Listing command (e.g. use sed to modify output of ls command to match the WinSCP requirements);
    • Clear aliases (may help if the ls command is aliased to display non standard output) and
    • Clear national variables (may help if your listing does not use English month names).
  • Make sure you are using bash shell. If you do not want to set it as your default shell, force it for WinSCP sessions.

Last modified: by Petr