Topic "How can I suppress extra feedback from a ls command?"

Author Message
rob przybylo
[View user's profile]

Joined: 2015-07-14
Posts: 1
How can I suppress feedback coming from a remote sftp server? I only want one short list of the files in the remote directory.

I'm running a SQL Server SSIS script task that executes sftp and runs an ls command, which I write to a command file, from the remote directory in order to get a list of files I need to pull. I'm getting feedback from the remote server that upsets my parsing routine.

Here's an example from the log file with the extra lines I'd like to suppress with a dot "." in the first column:

> 2015-07-14 10:04:17.841 Script: ls
. 2015-07-14 10:04:17.841 Listing directory "/u01/ftphomes/alpinecmssftp/inbound/echi-vw".
> 2015-07-14 10:04:17.842 Type: SSH_FXP_OPENDIR, Size: 52, Number: 779
< 2015-07-14 10:04:17.844 Type: SSH_FXP_HANDLE, Size: 13, Number: 779
> 2015-07-14 10:04:17.844 Type: SSH_FXP_READDIR, Size: 13, Number: 1036
< 2015-07-14 10:04:17.847 Type: SSH_FXP_NAME, Size: 1522, Number: 1036
> 2015-07-14 10:04:17.848 Type: SSH_FXP_READDIR, Size: 13, Number: 1292
< 2015-07-14 10:04:17.849 Type: SSH_FXP_STATUS, Size: 28, Number: 1292
< 2015-07-14 10:04:17.850 Status code: 1
> 2015-07-14 10:04:17.850 Type: SSH_FXP_CLOSE, Size: 13, Number: 1540
. 2015-07-14 10:04:17.851 acd.dat;-;54;2015-07-14T06:01:05.000Z;"alpinecmssftp" [3016];"ftp" [50];rw-r--r--;0
. 2015-07-14 10:04:17.852 chr3401.52;-;379809;2015-07-14T16:01:05.000Z;"alpinecmssftp" [3016];"ftp" [50];rw-r--r--;0
. 2015-07-14 10:04:17.852 aux_rsn.dat;-;221;2015-07-14T06:01:06.000Z;"alpinecmssftp" [3016];"ftp" [50];rw-r--r--;0
. 2015-07-14 10:04:17.853 cwc.dat;-;78;2015-07-14T06:01:06.000Z;"alpinecmssftp" [3016];"ftp" [50];rw-r--r--;0
. 2015-07-14 10:04:17.853 chr3501.53;-;2644;2015-07-14T16:01:05.000Z;"alpinecmssftp" [3016];"ftp" [50];rw-r--r--;0
. 2015-07-14 10:04:17.854 vdn.dat;-;22064;2015-07-14T06:01:07.000Z;"alpinecmssftp" [3016];"ftp" [50];rw-r--r--;0
. 2015-07-14 10:04:17.854 tkgrp.dat;-;833;2015-07-14T06:01:07.000Z;"alpinecmssftp" [3016];"ftp" [50];rw-r--r--;0
. 2015-07-14 10:04:17.855 .;d;0;2015-07-14T16:01:05.000Z;"alpinecmssftp" [3016];"ftp" [50];rwxr-xr-x;2
. 2015-07-14 10:04:17.856 split.dat;-;4702;2015-07-14T06:01:06.000Z;"alpinecmssftp" [3016];"ftp" [50];rw-r--r--;0
. 2015-07-14 10:04:17.856 archive;d;0;2015-07-14T15:55:03.000Z;"alpinecmssftp" [3016];"ftp" [50];rwxr-xr-x;0
. 2015-07-14 10:04:17.857 agname.dat;-;43839;2015-07-14T06:01:06.000Z;"alpinecmssftp" [3016];"ftp" [50];rw-r--r--;0
. 2015-07-14 10:04:17.857 ..;d;0;2013-05-16T20:06:36.000Z;"alpinecmssftp" [3016];"ftp" [50];rwxr-xr-x;0
. 2015-07-14 10:04:17.858 vector.dat;-;1126;2015-07-14T06:01:07.000Z;"alpinecmssftp" [3016];"ftp" [50];rw-r--r--;0
< 2015-07-14 10:04:17.859 Script: -rw-r--r-- 1 alpinecmssftp ftp 54 Jul 14 0:01:05 2015 acd.dat
< 2015-07-14 10:04:17.859 Script: -rw-r--r-- 1 alpinecmssftp ftp 379809 Jul 14 10:01:05 2015 chr3401.52
< 2015-07-14 10:04:17.860 Script: -rw-r--r-- 1 alpinecmssftp ftp 221 Jul 14 0:01:06 2015 aux_rsn.dat
< 2015-07-14 10:04:17.860 Script: -rw-r--r-- 1 alpinecmssftp ftp 78 Jul 14 0:01:06 2015 cwc.dat
< 2015-07-14 10:04:17.861 Script: -rw-r--r-- 1 alpinecmssftp ftp 2644 Jul 14 10:01:05 2015 chr3501.53
< 2015-07-14 10:04:17.862 Script: -rw-r--r-- 1 alpinecmssftp ftp 22064 Jul 14 0:01:07 2015 vdn.dat
< 2015-07-14 10:04:17.862 Script: -rw-r--r-- 1 alpinecmssftp ftp 833 Jul 14 0:01:07 2015 tkgrp.dat
< 2015-07-14 10:04:17.863 Script: drwxr-xr-x 3 alpinecmssftp ftp 4096 Jul 14 10:01:05 2015 .
< 2015-07-14 10:04:17.863 Script: -rw-r--r-- 1 alpinecmssftp ftp 4702 Jul 14 0:01:06 2015 split.dat
< 2015-07-14 10:04:17.864 Script: drwxr-xr-x 2 alpinecmssftp ftp 4919296 Jul 14 9:55:03 2015 archive
< 2015-07-14 10:04:17.865 Script: -rw-r--r-- 1 alpinecmssftp ftp 43839 Jul 14 0:01:06 2015 agname.dat
< 2015-07-14 10:04:17.865 Script: drwxr-xr-x 4 alpinecmssftp ftp 4096 May 16 14:06:36 2013 ..
< 2015-07-14 10:04:17.866 Script: -rw-r--r-- 1 alpinecmssftp ftp 1126 Jul 14 0:01:07 2015 vector.dat
> 2015-07-14 10:04:17.866 Script: close

Here's what the log file should look like, which I run on a different server:


> 2015-07-14 10:05:02.310 Script: ls
. 2015-07-14 10:05:02.310 Listing directory "/u01/ftphomes/alpinecmssftp/inbound/echi-vw".
> 2015-07-14 10:05:02.310 Type: SSH_FXP_OPENDIR, Size: 52, Number: 1291
< 2015-07-14 10:05:02.310 Type: SSH_FXP_HANDLE, Size: 13, Number: 1291
> 2015-07-14 10:05:02.310 Type: SSH_FXP_READDIR, Size: 13, Number: 1548
< 2015-07-14 10:05:02.310 Type: SSH_FXP_NAME, Size: 1522, Number: 1548
> 2015-07-14 10:05:02.310 Type: SSH_FXP_READDIR, Size: 13, Number: 1804
< 2015-07-14 10:05:02.310 Type: SSH_FXP_STATUS, Size: 28, Number: 1804
< 2015-07-14 10:05:02.310 Status code: 1
> 2015-07-14 10:05:02.310 Type: SSH_FXP_CLOSE, Size: 13, Number: 2052
< 2015-07-14 10:05:02.310 Script: -rw-r--r-- 1 alpinecmssftp ftp 54 Jul 14 1:01:05 2015 acd.dat
< 2015-07-14 10:05:02.310 Script: -rw-r--r-- 1 alpinecmssftp ftp 379809 Jul 14 11:01:05 2015 chr3401.52
< 2015-07-14 10:05:02.310 Script: -rw-r--r-- 1 alpinecmssftp ftp 221 Jul 14 1:01:06 2015 aux_rsn.dat
< 2015-07-14 10:05:02.310 Script: -rw-r--r-- 1 alpinecmssftp ftp 78 Jul 14 1:01:06 2015 cwc.dat
< 2015-07-14 10:05:02.310 Script: -rw-r--r-- 1 alpinecmssftp ftp 2644 Jul 14 11:01:05 2015 chr3501.53
< 2015-07-14 10:05:02.310 Script: -rw-r--r-- 1 alpinecmssftp ftp 22064 Jul 14 1:01:07 2015 vdn.dat
< 2015-07-14 10:05:02.310 Script: -rw-r--r-- 1 alpinecmssftp ftp 833 Jul 14 1:01:07 2015 tkgrp.dat
< 2015-07-14 10:05:02.310 Script: drwxr-xr-x 3 alpinecmssftp ftp 4096 Jul 14 11:01:05 2015 .
< 2015-07-14 10:05:02.310 Script: -rw-r--r-- 1 alpinecmssftp ftp 4702 Jul 14 1:01:06 2015 split.dat
< 2015-07-14 10:05:02.310 Script: drwxr-xr-x 2 alpinecmssftp ftp 4919296 Jul 14 10:55:03 2015 archive
< 2015-07-14 10:05:02.310 Script: -rw-r--r-- 1 alpinecmssftp ftp 43839 Jul 14 1:01:06 2015 agname.dat
< 2015-07-14 10:05:02.310 Script: drwxr-xr-x 4 alpinecmssftp ftp 4096 May 16 15:06:36 2013 ..
< 2015-07-14 10:05:02.310 Script: -rw-r--r-- 1 alpinecmssftp ftp 1126 Jul 14 1:01:07 2015 vector.dat
> 2015-07-14 10:05:02.310 Script: close
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
You are probably using a different version of WinSCP for each script.

---

Anyway, you are not supposed to parse WinSCP session log file.
Use XML log file.
http://winscp.net/eng/docs/logging_xml

Or even better, use WinSCP .NET assembly, so you do not have to parse anything.
http://winscp.net/eng/docs/library
http://winscp.net/eng/docs/library_ssis
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License