publish
plugins.it2be_ftp.SFTPfile info


Servoy Properties Summary
String absolutePath
Boolean isDirectory
Boolean isFile
Boolean isSymbolicLink
String name


Servoy Properties Details


absolutePath
String  absolutePath
Returns the absolute path to this file.
Returns
String  String

Supported Clients
SmartClient, WebClient, NGClient

Sample
// set the settings needed to log into the server
// alternative is the use of a keystore instead of a password
var vSettings = plugins.it2be_ftp.createPasswordSettings("host", "user", "password");

// Create a client for the SFTP connection
var vClient = plugins.it2be_ftp.createSFTPclient(vSettings);

// 'Build' the connection and when the connection returns true
// start executing the rest of the code
if (vClient.connect()) {
// Check the status of the connection
application.output(vClient.getStatus());

// Create a list (array) of SFTPFiles
var vList = vClient.list();

// Loop through the SFTPFiles
for (var vIndex = 0 ; vIndex < vList.length ; vIndex++) {
// Retrieve the file at the selected index
var vFile = vList[vIndex];

// Output the name, size and timestamp of the SFTPFile
application.output(vFile.name + " - " + vFile.size + " - " + vFile.timeStamp);

// When the SFTPFile is of file type retrieve the data for it
// Here you could create a method to loop through the folder if
// the file type is a folder
if (vFile.isFile) {
vClient.get(vFile.name, "path/" + vFile.name);
}
}

// Disconnect the client
application.output(vClient.disconnect());
}


isDirectory
Boolean  isDirectory
Returns true when the SFTPFile is a directory.
Returns
Boolean  result boolean

Supported Clients
SmartClient, WebClient, NGClient

Sample
// set the settings needed to log into the server
// alternative is the use of a keystore instead of a password
var vSettings = plugins.it2be_ftp.createPasswordSettings("host", "user", "password");

// Create a client for the SFTP connection
var vClient = plugins.it2be_ftp.createSFTPclient(vSettings);

// 'Build' the connection and when the connection returns true
// start executing the rest of the code
if (vClient.connect()) {
// Check the status of the connection
application.output(vClient.getStatus());

// Create a list (array) of SFTPFiles
var vList = vClient.list();

// Loop through the SFTPFiles
for (var vIndex = 0 ; vIndex < vList.length ; vIndex++) {
// Retrieve the file at the selected index
var vFile = vList[vIndex];

// Output the name, size and timestamp of the SFTPFile
application.output(vFile.name + " - " + vFile.size + " - " + vFile.timeStamp);

// When the SFTPFile is of file type retrieve the data for it
// Here you could create a method to loop through the folder if
// the file type is a folder
if (vFile.isFile) {
vClient.get(vFile.name, "path/" + vFile.name);
}
}

// Disconnect the client
application.output(vClient.disconnect());
}


isFile
Boolean  isFile
Returns true when it is a file.
Returns
Boolean  result boolean

Supported Clients
SmartClient, WebClient, NGClient

Sample
// set the settings needed to log into the server
// alternative is the use of a keystore instead of a password
var vSettings = plugins.it2be_ftp.createPasswordSettings("host", "user", "password");

// Create a client for the SFTP connection
var vClient = plugins.it2be_ftp.createSFTPclient(vSettings);

// 'Build' the connection and when the connection returns true
// start executing the rest of the code
if (vClient.connect()) {
// Check the status of the connection
application.output(vClient.getStatus());

// Create a list (array) of SFTPFiles
var vList = vClient.list();

// Loop through the SFTPFiles
for (var vIndex = 0 ; vIndex < vList.length ; vIndex++) {
// Retrieve the file at the selected index
var vFile = vList[vIndex];

// Output the name, size and timestamp of the SFTPFile
application.output(vFile.name + " - " + vFile.size + " - " + vFile.timeStamp);

// When the SFTPFile is of file type retrieve the data for it
// Here you could create a method to loop through the folder if
// the file type is a folder
if (vFile.isFile) {
vClient.get(vFile.name, "path/" + vFile.name);
}
}

// Disconnect the client
application.output(vClient.disconnect());
}


name
String  name
Get the name of the file.
Returns
String  name String

Supported Clients
SmartClient, WebClient, NGClient

Sample
// set the settings needed to log into the server
// alternative is the use of a keystore instead of a password
var vSettings = plugins.it2be_ftp.createPasswordSettings("host", "user", "password");

// Create a client for the SFTP connection
var vClient = plugins.it2be_ftp.createSFTPclient(vSettings);

// 'Build' the connection and when the connection returns true
// start executing the rest of the code
if (vClient.connect()) {
// Check the status of the connection
application.output(vClient.getStatus());

// Create a list (array) of SFTPFiles
var vList = vClient.list();

// Loop through the SFTPFiles
for (var vIndex = 0 ; vIndex < vList.length ; vIndex++) {
// Retrieve the file at the selected index
var vFile = vList[vIndex];

// Output the name, size and timestamp of the SFTPFile
application.output(vFile.name + " - " + vFile.size + " - " + vFile.timeStamp);

// When the SFTPFile is of file type retrieve the data for it
// Here you could create a method to loop through the folder if
// the file type is a folder
if (vFile.isFile) {
vClient.get(vFile.name, "path/" + vFile.name);
}
}

// Disconnect the client
application.output(vClient.disconnect());
}