You can see in the log file below that it is ignoring my "test" folder, this is the folder I want to read from.
In the FileMask: I thought adding " | */" would make it ignore all child sub directories, but it seems to apply to the top Directory "Test". Thanks for help with this.
Part of Log file:
2015-01-05 13:32:35.692 Script: get -nopermissions -preservetime -transfer="automatic" -filemask="User.txt; Address.txt; LSTEmployer.txt; LSTEmpAddr.txt; Cost.txt; Rate.txt; LSTRate.txt; LSTCost.txt; Quest.txt; | */" -- "/rt/bigbird/eit/sql/test/" "C:\Temp\SFTP_ProgressTests\HAB\Efile_SQL\*"
. 2015-01-05 13:32:35.702 Listing file "/rt/bigbird/eit/sql/test/".
> 2015-01-05 13:32:35.704 Type: SSH_FXP_LSTAT, Size: 34, Number: 263
< 2015-01-05 13:32:35.709 Type: SSH_FXP_ATTRS, Size: 37, Number: 263
. 2015-01-05 13:32:35.710 ;D;1024;2014-12-30T17:15:25.000Z;"" [0];"" [3];rwxrwxrwx;1
. 2015-01-05 13:32:35.711 File "/rt/bigbird/eit/sql/test/" excluded from transfer
* 2015-01-05 13:32:35.712 (EScpSkipFile)
> 2015-01-05 13:32:36.652 Script: exit
. 2015-01-05 13:32:36.653 Script: Exit code: 0
. 2015-01-05 13:32:36.654 Closing connection.
. 2015-01-05 13:32:36.654 Sending special code: 12
. 2015-01-05 13:32:36.655 Sent EOF message
My code: C#
public void SFTP_GetFiles() {
try {
SessionOptions sessionOptions = null;
getSessionOptions(_ftpServer, _userName, _password,ref sessionOptions);
using (Session session = new Session()) {
// Connect
session.ExecutablePath = _WinScpExec_Path;
session.SessionLogPath = @"\\<blah>\WorkingFiles\WinSCP\log123.txt";
session.Open(sessionOptions);
// download files
TransferOptions transferOptions = new TransferOptions();
transferOptions.FileMask = _fileList;
transferOptions.TransferMode = (TransferMode)Enum.Parse(typeof(TransferMode), _fileTransferMode_Ascii_Binary_Automatic, true); ;
_dtFtpStart = DateTime.Now;
//chained error throw
session.GetFiles(_remotePath, _localPath, _bDeleteFilefromServer, transferOptions).Check();
}
}
catch (Exception ex) {
throw new Exception("BOS.Shared.WinScp_SFTP method: SFTP_GetFiles failed: " + _ftpServer + " " + ex.Message);
}
}