Unfortunately, it is not possible using FileSet
class. The class only filters the items to process, but it cannot prioritize them.
However, you can do it relatively simply.
Define your FileSet
and call GetLocalItems()
. You will get the list of all local items to be uploaded (matching the specified set). You can process it and upload files in cycle using the Sftp.PutFile()
method.
Or, you can use maybe even easier approach. Call Sftp.Upload()
method multiple times for each file extension you want to process.
Example:
for (int i = 0; i < 3; i++)
{
// define file set
var set = new FileSet(@"c:\data");
switch (i)
{
case 0:
set.Include("*.txt", TraversalMode.MatchFilesDeep);
break;
case 1:
set.Include("*.xml", TraversalMode.MatchFilesDeep);
break;
case 2:
set.Include("*", TraversalMode.MatchFilesDeep);
set.Exclude("*.txt", TraversalMode.MatchFilesDeep);
set.Exclude("*.xml", TraversalMode.MatchFilesDeep);
break;
default:
throw new InvalidOperationException("Undefined value.");
}
// upload files
client.Upload(set, "/");
}