Topic "Filemask problem"

Author Message
buho
[View user's profile]

Joined: 2014-12-03
Posts: 3
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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
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.
_________________
Martin Prikryl
buho
[View user's profile]

Joined: 2014-12-03
Posts: 3
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);

}
}
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
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).
_________________
Martin Prikryl
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