Filemask problem

Advertisement

buho
Joined:
Posts:
3

Filemask problem

Hello,

I am using a file mask as such Rate.txt; Address.txt; Help.txt; | */

with a remoteDirectory like /rt/my/no/yours/test/

I am using GetFiles method.

When I run the code none of the files are found, even though files exist for the filemask, if I remove the "*/" I get the "test" folder created and any sub directories in the test folder. All I want is the match .txt files.

What am I doing wrong?

thanks

Buho

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Filemask problem

Please share your code and session log file.

To generate 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

buho
Joined:
Posts:
3

Re: Filemask problem

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);

}
}

Reply with quote

martin
Site Admin
martin avatar

Re: Filemask problem

You have to use /rt/bigbird/eit/sql/test/* to tell WinSCP to download contents of the test folder, not the folder itself (that gets excluded by the mask).

Reply with quote

Advertisement

You can post new topics in this forum